w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.52k stars 673 forks source link

Suggestion: Ability to adjust the height of a display:inline-block element without pushing away other elements. #4973

Open HT-7 opened 4 years ago

HT-7 commented 4 years ago

Moderators of news aggregator subverses (e.g. subreddits on Reddit) are able to create a custom CSS for their community page.

But they can not edit the HTML. Therefore, they are limited to the possibilities that CSS offers.

Some moderators choose a multi-column design for their community (screenshot found here), which can be achieved by reducing the width of one post element and applying display:inline-block. In that example screenshot, two post boxes are seen per row.

I have seen a different community (forgot where exactly) where each post had a box around it. Apparently, it was based on the so-called Naut design.

But there are some limitations:

But a much more elegant solution in the latter case would be having a box expand to its full height on :hover, but that hits two CSS walls (limitations) as well:

There are likely solutions involving HTML, but as already mentioned, moderators of subreddits on Reddit (and similar sites) are bound to the limitations of CSS. Therefore, it would be good if the possibilities of CSS get expanded, even if there is already a HTML-supported workaround.

Loirooriol commented 4 years ago

If you are increasing the height but don't want to push following elements, just add a negative margin-bottom?

frivoal commented 4 years ago

Also, it seems that this design would be better served by using https://drafts.csswg.org/css-grid/ and having each post be a grid item rather than by using inline-blocks. In the case of Reddit, this should be doable without changes to the HTML markup, since the posts are direct children of a container element.