display property is used to determine if and how an element appears. The most common values are shown below:
For a full list of
display values, see https://developer.mozilla.org/en-US/docs/Web/CSS/display.
We use the
display property to control how an element displays on the page - to control its rendering box. The default value for most elements is either:
<h1>, and others;
<a>, and others.
We can set
none to hide an element. The
display property is often used to:
- To show elements hide elements on a particular media. For example, you might want to hide advertisements on the printed version of a page.
tables and lists
It is possible to use
display to make non-table elements act like table elements and non-list elements act like list elements, but it is always better to use actual table
and list elements to create tables and lists.
The following example shows how the
display property can be used to turn links into block elements: