Display - logaegae/project_study GitHub Wiki

Display

The display property specifies if/how an element is displayed.

Block-level Elements

A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can).

Inline Elements

An inline element does not start on a new line and only takes up as much width as necessary.

Display: none;

display: none; is commonly used with JavaScript to hide and show elements without deleting and recreating them. Take a look at our last example on this page if you want to know how this can be achieved.

visibility:hidden; also hides an element.

However, the element will still take up the same space as before. The element will be hidden, but still affect the layout:

list-item

table

table-cell