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:
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
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.Understood, thanks
You’re welcome