
Display
The Invisible Stage Direction
In the magical realm of CSS, display
decides how your elements appear—or if they even make it onto the stage at all! A block element enters with grand flair, commanding the entire space like a king on his throne. No one dares line up beside it.
Inline elements, on the other hand, are the graceful dancers in the background, taking only as much space as they need and quietly standing side by side.
Then there’s the diplomatic acrobat, inline-block, which has the size of a block but politely aligns with its peers. And if you truly wish to cast a spell, use display: none
to make an element vanish entirely, as if it were never there.
Visibility with Rules
Block, Inline, Inline-Block or simply gone – you decide how elements behave!

Display
The Stage Direction
With display, you tell your element how it should behave. Will it spread out like a majestic block, commanding attention? Or will it quietly align in a row like a slim inline element? Perhaps it might even vanish completely? The display property determines how an element fits into the webpage’s layout matrix, shaping its role on the stage.

Block
The Dominator
A block element is like a ruler on a throne: it claims the entire width, whether it truly needs the space or not. It always starts on a new line and tolerates no other elements in its row. For most HTML elements, this is the default behavior.
.element {
display: block;
}
The .element is displayed as a block element and occupies the entire available width.

Inline
The Graceful Dancer
Inline elements are the counterparts to block rulers. They glide effortlessly side by side, taking up only as much space as they need. They don’t force line breaks, allowing text, images, and links to coexist harmoniously in a single row.
.element {
display: inline;
}
The .element is displayed as an inline element and only takes up as much space as its content requires.

Inline-block
The Balancing Act Between Worlds
inline-block is the graceful performer walking the fine line between inline and block. It combines the best of both worlds: like an inline element, it stands politely in a row alongside its siblings, yet like a block element, it proudly defines its own width and height. It’s the perfect middle ground for elements that need to align side by side while retaining block-like control over their size and structure.
.element {
display: inline-block;
}
The .element combines properties of both block and inline elements: it aligns alongside other elements but can be styled like a block, with fixed widths and heights.

None
The Invisible One
Sometimes you need an element to vanish—no drama, no trace. With display: none, the element is removed from the layout as if it never existed. Perfect for making something disappear without disrupting the page flow—and you can easily summon it back from the void whenever needed.
.element {
display: none;
}
The .element is completely removed from the layout and remains invisible, taking up no space in the document.