3 ms·
Given that this article is talking about vertical alignment of, among other things, “text” and “buttons”, I was hoping they’d go into how to do proper alignment
by derefr 7y ago
Given that this article is talking about vertical alignment of, among other things, “text” and “buttons”, I was hoping they’d go into how to do proper alignment of inline-block elements of differing heights within the same inline reflow (e.g. text paragraph.)
I’ve yet to see a grid system that has guidance—let alone tooling!—for working with paragraphs of text which embed inline-block elements in them of “abnormal” block heights (= larger than the text’s own line-height) without somehow breaking the grid.
Picture, for example:
> You’re invited to [test-drive our new Beta]!
...where the text in brackets is a button, and this button has enough padding/border that it has, relative to the line height, ~1.5em of outer bounding-box height.
Before grid systems, this used to be a pretty classic appearance for a call-to-action!
I’d expect, if I were writing traditional bespoke CSS and not using a grid, that I could achieve all of the following at once:
1. the text inside the button is baseline-aligned with the text beside the button;
2. there isn’t too much or too little space between the edges of the button and the surrounding text—i.e. it feels like it’s “part of” the line of text, rather than feeling like the line of text and the button are two cells in a table;
3. the line of text that the button is a part of, within the paragraph of text, doesn’t awkwardly have different line-height than the other lines in its paragraph (which is what inline reflow chooses to do by default, unless you give all the lines in the paragraph that same line-height as a minimum.)
4. the paragraph doesn’t awkwardly have a different line-height than the other paragraphs on the page;
5. the paragraph doesn’t seem to have too much margin on the top/bottom edge compared to its immediate siblings (which usually happens, because line-height in CSS is applied per line, rather than being interspersed between the lines of a paragraph, meaning that it overpads the top line);
...but I have no idea how to achieve these properties together on a grid.
I feel like this is an important and oft-overlooked consideration, because “CTA button” here can be word-replaced with “emoji” or “highlighted reference to a username/tag” and you’ll end up with the same problems.