02. Display

To control how elements flow within our content, we use the display property.

The possible values include: inline, block, andinline-block.


A value of inline makes the element displayed within the flow of a line.

Some examples of inline-block elements that you may have seen are <span>, <em>, and <markup>

Remember that these elements do not start their own block, but rather situate themselves with the flow of the surrounding content.


When the display is set to block, the element is positioned with line breaks under and over it. Some of the default block elements in HTML include: <h1> and <p> tags.


In case you wanted a hybrid of both, we can specify, inline-block level elements. Here, the element will flow like an inline-element, but are able to have a specified height.


Using a value of none takes that element completely out of the page. This is useful for switching the visibility of an element on and off.

display: none vs. visibility: hidden

There is another CSS property similar to display: none called visibility: hidden that can also hide elements.

The difference is that display: none takes the element box completely out of play, while visibility: hidden keeps the box and flows it in place without the contents being visible.

If you don't want a blank space to appear, use display: none.

Build modern and responsive webpages

JavaScript & JQuery

Build modern and responsive webpages Try Front-end

This book was written for anyone who wants to use JavaScript to make their websites a little more interesting, engaging, interactive, or usable. In particular, it is aimed at people who do not have a degree in computer science (well, not yet anyway).

$ Check price
39.9939.99Amazon 4.5 logo(385+ reviews)

More Front-end resources

Aching back from coding all day?

Acupressure Mat & Pillow

Aching back from coding all day? Try Back Problems

Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.

$$ Check price
144.87144.87Amazon 4.5 logo(1,890+ reviews)

More Back Problems resources