Working with Inline Elements
Swipe to show menu
Inline elements stay on a single line and wrap to the next line when space runs out. This behavior is controlled by the CSS property display: inline.
Key points about inline elements:
- They default to
display: inline; - Their width and height are determined by their content and cannot be explicitly set;
- Only horizontal properties like
padding,margin, andbordercan be applied.
Let's examine an example where some styles impact the element, while others do not, within the CSS file:
index.html
index.css
Study More
By default,Β inlineΒ elements have a gap on the right side; forΒ imgΒ elements, this gap is at the bottom. This space is not attributed toΒ paddingΒ orΒ margin. Instead, it's an inherent blank space added by browsers to ensure a distance between each element.
index.html
Everything was clear?
Thanks for your feedback!
SectionΒ 6. ChapterΒ 4
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.56SectionΒ 6. ChapterΒ 4