Inline-block
noun
say it: “IN-lyne BLOK” /ˈɪnlaɪn blɒk/
A display value for a box that sits side by side with others in a line, like a word, but takes a width, a height and padding that pushes, like a block.
What does display: inline-block do?
An inline-block box sits side by side with its neighbors in a line of text, like a word, and wraps onto the next line when the row runs out of room. Unlike a plain inline box, it takes a width and a height, and its padding and margins push the boxes around it away. Menu buttons and tag pills are often inline-block.
.tags li { display: inline-block; padding: 4px 12px; }
In a sentence
- “The menu's list items are inline-block, so the links sit in one row and each one keeps its padding.”
- “I made the tags inline-block, and when the window got narrow they wrapped onto a second line like words.”
Level: Apprentice · More CSS terms at this level
Updated