The box model does not fully apply to items participating in an inline formatting context.

Hello folks. I'm going through the CSS Demystified course, and I'm facing some problems understanding something that Kevin says in the 'Introduction to Formatting Contexts' lesson. I've got problems with the following text:
The box model does not fully apply to items participating in an inline formatting context. In a horizontal writing mode line, horizontal padding, borders and margin will be applied to the element and push text away left and right. However, margins above and below the element will not be applied. Vertical padding and borders will be applied but may overlap content above and below as, in the inline formatting context, the line boxes will not be pushed apart by padding and borders
The box model does not fully apply to items participating in an inline formatting context. In a horizontal writing mode line, horizontal padding, borders and margin will be applied to the element and push text away left and right. However, margins above and below the element will not be applied. Vertical padding and borders will be applied but may overlap content above and below as, in the inline formatting context, the line boxes will not be pushed apart by padding and borders
Does this mean that the space between items in an inline formatting context is defined by the line-height property? Thanks in advance
3 Replies
snxxwyy
snxxwyy•6mo ago
A few things to note: A sequence of elements with display: inline; applied will appear next to eachother rather than on top of one another so you wouldn’t need to worry about horizontal space between inline items in this specific situation. And to answer your question, space can be added on the top and bottom if you increase the element’s line height but you shouldn’t use that to space things out. Instead, if you wish to create space between them horizontally, I’d either make the element an inline-block or block and use margin. If you want to create space in relation to the line height, you can use the lh unit for your margin.
CarlosDEV🤖🧙♂🤟
Understood, thanks
snxxwyy
snxxwyy•6mo ago
You’re welcome
Want results from more Discord servers?
Add your server