The display
property in
display: value;
none
: The element does not display completely.
block
: It is used to generate a box of block-level by the element.
flex
: It is used to display the element as the block-level flex container.
grid
: It is used to display the element as the block-level grid container.
inline
: It is used to generate a box of inline-level by the element.
contents
: By using this the element does not generate any box of it’s own but it’s pseudo-elements and children elements still generate boxes as normal.
inline-block
: It is used to behave the element as the inline flow-root.
inline-flex
: It is used to behave as the inline flex.
inline-grid
: It is used to behave as the inline grid.
inline-table
: It is used to behave as the inline table.
table
: It is used to behave all the elements in the form of a <table>
element.
run-in
: It is used to display the element as the block, inline depending upon the text.
list-item
: It is used to behave all the elements in the form of a <li>
element.
table-column-group
: It is used to behave all the elements in the form of a <colgroup>
element.
table-caption
: It is used to behave all the elements in the form of a <caption>
element.
table-header-group
: It is used to behave all the elements in the form of a <thead>
element.
table-footer-group
: It is used to behave all the elements in the form of a <tfoot>
element.
table-row-group
: It is used to behave all the elements in the form of a <tbody>
element.
table-row
: It is used to behave all the elements in the form of a <tr>
element.
table-column
: It is used to behave all the elements in the form of a <col>
element.
table-cell
: It is used to behave all the elements in the form of a <td>
element.
initial
: This sets the value to its default value.
inherit
: This inherits property from its parent value.
The following is the basic
In this example, we can see that we have implemented four different display properties to show the difference between them.
We can also change and set the property according to our own choice.