惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
N
News and Events Feed by Topic
T
Tailwind CSS Blog
WordPress大学
WordPress大学
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
B
Blog RSS Feed
L
LangChain Blog
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
博客园 - Franky
T
Tor Project blog
C
Cisco Blogs
A
About on SuperTechFans
Spread Privacy
Spread Privacy
博客园 - 司徒正美
T
Threatpost
Engineering at Meta
Engineering at Meta
Forbes - Security
Forbes - Security
阮一峰的网络日志
阮一峰的网络日志
Recorded Future
Recorded Future
宝玉的分享
宝玉的分享
O
OpenAI News
N
News | PayPal Newsroom
博客园 - 聂微东
美团技术团队
Help Net Security
Help Net Security
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
G
Google Developers Blog
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
AWS News Blog
AWS News Blog
H
Hacker News: Front Page
Cloudbric
Cloudbric
Project Zero
Project Zero
V
Visual Studio Blog
F
Full Disclosure
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
S
SegmentFault 最新的问题
P
Palo Alto Networks Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
SecWiki News
SecWiki News
P
Proofpoint News Feed
Know Your Adversary
Know Your Adversary

oida.dev | TypeScript, Rust

TypeScript's `erasableSyntaxOnly` Flag Unsafe for work Tokio: Macros Tokio: Channels Tokio: Getting Started Network Applications on the Tokio Stack Remake, Remodel, Reduce. The `never` type and error handling in TypeScript 5 Inconvenient Truths about TypeScript Refactoring in Rust: Introducing Traits Refactoring in Rust: Abstraction with the Newtype Pattern Announcing the TypeScript Cookbook TypeScript: Iterating over objects The road to universal JavaScript 10 years of oida.dev Rust: Tiny little traits The TypeScript converging point How not to learn TypeScript Getting started with Rust Introducing Slides and Coverage TypeScript: The humble function overload TypeScript + React: Children types are broken TypeScript: In defense of any Rust: Enums to wrap multiple errors Dissecting Deno Error handling in Rust TypeScript: Unexpected intersections Upgrading Node.js dependencies after a yarn audit TypeScript: Array.includes on narrow types TypeScript + React: Typing Generic forwardRefs shared, util, core: Schroedinger's module names Learning Rust and Go TypeScript: Narrow types in catch clauses TypeScript: Low maintenance types Tidy TypeScript: Name your generics Tidy TypeScript: Avoid traditional OOP patterns Tidy TypeScript: Prefer type aliases over interfaces Tidy TypeScript: Prefer union types over enums My new book: TypeScript in 50 Lessons Go Preact! ❤️ this in JavaScript and TypeScript TypeScript and ECMAScript Modules TypeScript + React: Why I don't use React.FC TypeScript + React: Component patterns TypeScript: Augmenting global and lib.dom.d.ts Vite with Preact and TypeScript TypeScript: Union to intersection type 11ty: Generate Twitter cards automatically Are large node module dependencies an issue? TypeScript: Variadic Tuple Types Preview TypeScript: Improving Object.keys Remake, Remodel. Part 4. TypeScript + React: Typing custom hooks with tuple types TypeScript: Assertion signatures and Object.defineProperty TypeScript: Check for object properties and narrow down type Boolean in JavaScript and TypeScript void in JavaScript and TypeScript Symbols in JavaScript and TypeScript Why I use TypeScript TypeScript + React: Extending JSX Elements TypeScript: Validate mapped types and const context TypeScript: Match the exact object shape TypeScript: The constructor interface pattern Streaming your Meetup - Part 4: Directing and Streaming with OBS Streaming your Meetup - Part 3: Speaker audio Streaming your Meetup - Part 2: Speaker video Streaming your Meetup - Part 1: Basics and Projector TypeScript and React Guide: Added a new styles chapter TypeScript and React Guide: Added a new render props chapter TypeScript and React: Styles and CSS TypeScript and React TypeScript and React Guide: Added a new prop types chapter TypeScript without TypeScript -- JSDoc superpowers TypeScript: Mapped types for type maps JAMStack vs serverless web apps The Unsung Benefits of JAMStack Sites TypeScript: Ambient modules for Webpack loaders My most favourite talks in 2018 TypeScript and React Guide: Added a new context chapter TypeScript: Built-in generic types TypeScript: Type predicates JSX is syntactic sugar TypeScript and React Guide: Added a new hooks chapter Getting your CfP application right FAQ on our Angular Connect Talk: Automating UI development TypeScript and Substitutability Debugging Node.js apps in TypeScript with Visual Studio Code From Medium: Deconfusing Pre- and Post-processing From Medium: PostCSS misconceptions Saving and scraping a website with Puppeteer Cutting the mustard - 2018 edition Wordpress as CMS for your JAMStack sites My most favourite podcast episodes in 2017 My most favourite talks in 2017 My most favourite books in 2017 The Best Request Is No Request, Revisited Not so hidden figures - Organizing ScriptConf My podcast journey to ScriptCast Grid layout, grid layout everywhere! #scriptconf and #devone
Content vs. value
2013-10-21 · via oida.dev | TypeScript, Rust

Title’s for all content strategists out there who expect something really meta and with a lot of additional bla bla. Well, this is about HTML Content vs. Input Values.

Margin and Sass expert Kitty Giraudel (check out their awesome blog, btw!) brought up a pretty nice sample on Codepen, showing an input field resizing its width depending on the characters typed in, using the new ‘ch’ unit. The original question was, if there was a CSS only way to recreate this behavior:

Do any of you guys think of a pure CSS way to make an input element wrap around its content? I’m not sure it’s possible actually.

And Kitty is completely right, it isn’t possible. And that’s per definition. input elements are content-less in HTML terms, since they can’t hold content like other HTML elements do:

<p>this is content</p>
<span>this is also content</span>
<input>IMPOSSIBLE</input>

The last one is bogus. Correct way would be &lt;input type="text" value="That is better"&gt;. Auto-width in CSS is only possible with elements that can have content.

If you compare it to other CSS techniques, you’ll notice that input elements can’t have pseudo elements like :before and :after because of the very same reason. Those two elements are placed before and after the content of one element:

<p>
<before goes here>
Content
<after goes there>
</p>

I’m not sure why inputs can’t have content. I assume it has something to do with being connected tightly with the Operating System (at least in the past). Maybe you can help me on that one. The spec defines them as void elements which aren’t allowed to have content in any way.

How can you achieve this behavior CSS only? #

Drop accessibility and use a span.

<span contenteditable>
this is my content
</span>

But hey, not being accessible is not what we want. So use Kitty’s sample. This should work just fine for you!

Related Articles