CSS Display Property
Here are some of the most common values for the display property ↗:
-
block: The element takes up the full width available, starting on a new line. Examples include<div>,<p>, and<h1>. -
inline: The element takes up only as much width as it needs and does not start on a new line. Examples include<span>,<a>, and<strong>. -
inline-block: Combines features of bothblockandinline. The element behaves like an inline element (doesn’t start on a new line) but allows setting width and height like a block-level element. -
none: The element is not displayed at all. It is removed from the document flow, and no space is reserved for it. This is commonly used for hiding elements. -
flex: This makes the element a flex container, allowing you to use flexbox to manage the layout of its children. It enables dynamic alignment and distribution of items within the container. -
grid: This makes the element a grid container, enabling you to use CSS Grid Layout to create two-dimensional layouts with rows and columns. -
inline-flex: Similar toflex, but the container behaves like an inline element (not breaking onto a new line). -
inline-grid: Similar togrid, but the container behaves like an inline element.