327/361

What is the CSS display property and can you give a few examples of its use?

Quiz · CSS
Medium
3 min
css
  • none, block, inline, inline-block, flex, grid, table, table-row, table-cell, list-item.
displayDescription
noneDoes not display an element (the element no longer affects the layout of the document). All child element are also no longer displayed. The document is rendered as if the element did not exist in the document tree
blockThe element consumes the whole line in the block direction (which is usually horizontal)
inlineElements can be laid out beside each other
inline-blockSimilar to inline, but allows some block properties like setting width and height
tableBehaves like the <table> element
table-rowBehaves like the <tr> element
table-cellBehaves like the <td> element
list-itemBehaves like a <li> element which allows it to define list-style-type and list-style-position

Adapted from the Front End Interview Handbook by Yangshun Tay and contributors (MIT License). Source

Spotted a mistake or a rights concern? Report an issue