Hacker News new | ask | show | jobs
by bigbuppo 171 days ago
It's because an inline element, like applying italics to text, are expected to behave a certain way. Additionally, it may be inheriting some properties from that cascade thing, and you really don't want it to behave like anything other than an inline element unless you explicity want it to not behave like that.

It's like wondering why this grape doesn't taste like fried catfish. They're both food. Why don't they taste the same?

1 comments

What ever that "certain way" it's supposed to act, someone obviously wants it to act different if they set a height and width. Having to redefine the display time is a needless extra step that the user has to "just know" when the intention could easily be inferred.
Okay; would you like it to change to inline-block or block or grid?

Width and height are meaningless for inline elements, but automatically changing the display would be more confusing, not less.

> Width and height are meaningless for inline elements

Really not sure what you're trying to get at there, obviously any element that displays will have a width and height. Maybe you meant a user specified width/height, but the entire point of my post is an inline-block is an inline element with a specifiable width and height. And we've always had the IMG tag, which is also an inline element with a specifiable width and height. The obvious and intuitive choice would have been to not put artificial limits on inline elements.

It's not a limit. It's an expected behavior and you can still deviate from that anyway you wish.

You could even do something crazy like `* {display: block;}` if you really want, and then go from there. Nobody can stop you. The freedom is yours.