Hacker News new | ask | show | jobs
by CM30 2880 days ago
Who actually thought rendering the white space between inline-block elements was a good idea in the first place?

Seriously, I genuinely cannot see a use case where this setup would make things better, and it's quite clear that in 95% of them it just makes things harder for web developers. Pretty much no one uses this to align anything, and any use cases I can see could be done better with margins.

Just ignore the spaces between inline-block elements and instruct browsers to strip them out.

2 comments

They’re elements that appear as inline to their surroundings, and blocks to their contents. In what way wouldn’t you want it to render white space in the same way as other inline elements?

If you’re misusing inline-block for generic layout then you really should be looking at Flexbox and not trying to neuter the intended behaviour.

Putting yourself in the driver's seat decades ago, how should these render? What content should the browser put on the clipboard? How should text selection work?

    <s>See</s> <s>Spot</s> <s>run.</s>
    <s>See</s> Spot <s>run.</s>
Given that HTML is a text markup language, it made sense for text (including whitespace) to be significant, and the SGML to be minimally disruptive. 10% tags 90% text.

Now, in 2018 we want to develop applications not documents, and our HTML is now 90% tags 10% text.

In retrospect, inline should do what inline-block does now. And flexbox should have been used instead of many table/inline-block/float hacks. CSS is a mess: 20/100 foresight and 20/20 hindsight.