In HTML/CSS, inline elements, such as
<span>, do not support explicitly setting their width via the
width CSS property.
This is confusing to many developers, as questions like "Setting the width of inline elements" show.
When learning technologies, I always find it helpful to understand the "why?", the motivation behind design decisions. So:
Why was it decided for inline elements to not support setting
- Are there technical reasons that would make it hard to implement in browsers?
- Did the designers of CSS think that allowing it would be redundant?
- Or did someone just think "We'll ignore
widthfor inline elements just to spite people."? (Well, hopefully not.)