3 ms·
What do you mean "semantic"? CSS is for presentation, not semantics.
by goto11 6y ago
What do you mean "semantic"? CSS is for presentation, not semantics.
- sodapopcan 6y agoLike, before the best way to do it in CSS was the change the display type of an element to a “table cell” even if it’s not a part of a table. I mean, changing it to “flex” or “grid” doesn’t make much sense either, really, I rather just have a box with vertically aligned content. I dunno, am I using the word semantic wrong?
- goto11 6y agoOK I agree it was not intuitive to change the display-type to table-cell just in order to vertically center content. It basically mirrored how you would would vertically center in presentational HTML, except you didn't need to misuse the semantics of the table element (which is why I was initially confused by your comment about semantics.) The flex-box approach is the most intuitive in my opinion. The flex display-type basically means you want to distribute the area of a box among its immediate child elements, and control how the children and aligned relative to the container and each other. Centering is naturally part of this. Using grid is IMHO less intuitive, since a grid with a single cell seem just as much a hack as a table with a single cell.
- sodapopcan 6y agoYep, I do agree that of any of them, flex makes the most sense from a language standpoint.