Locked lesson.
About this lesson
Understanding how an element is displayed with CSS.
Exercise files
Download this lesson’s related exercise files.
Display.docx58.7 KB Display - Solution.docx
58.9 KB
Quick reference
Display
It is possible to change a block element to an inline element and an inline element to a block element with CSS with the display property.
When to use
Whenever you want to change a block to an inline or vice versa.
Instructions
To change a block/inline element, use the display property:
display: inline;
or
display: block;
Hints & tips
- Change a block to inline with display: inline;
- Change inline to block with discplay: block;
- An inline element takes up just the space immediately around it.
- A block element takes up the whole width of the row it sits on.
Lesson notes are only available for subscribers.