Display property can be changed in CSS. It allows you to set whether an element is displayed as an inline or block property. Display property can be set between three basic types:
- Inline - Width and height property are ignored. Margin & padding push elements away horizontally but not vertically.
- Block - Block elements break the flow of a document. Width, height, margin & padding are respected.
- Inline-block - Behaved like an inline element except width, height, margin & padding are respected.
There a many more display types such as flex and grid.
A quick way to hide an element
To hide an element, you can set their display to none. It’s still in the document, it’s just not taking up any space or visible.
.element {
display: none;
}