Building Your Learning Module...
Getting things ready for you!
Find videos you like?
Save to resource drawer for future reference!
display property controls how an element participates in the layout. Does it take full width? Can it sit next to other elements? Does it create a new line? This property answers all these questions."How should this element behave in the page layout?"
Takes full width available. Starts on a new line. Can set width/height.
display: block;Examples: <div>, <p>, <h1>, <section>
Only takes needed width. Sits next to other inline elements. Cannot set width/height.
display: inline;Examples: <span>, <a>, <strong>, <em>
Sits next to other elements BUT you can set width/height. Perfect hybrid!
display: inline-block;Common for: Buttons, navigation items, card grids
Element is completely removed from the layout. No space reserved.
display: none;Common for: Hiding elements, modals, dropdown menus
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="container">
<h1>📐 Display Property Demo</h1>
<div class="section">
<div class="label label-block">display: block</div>
<div class="block-demo">
<div>Block Element 1 (Takes full width)</div>
<div>Block Element 2 (New line)</div>
<div>Block Element 3 (New line)</div>
</div>
<div class="note">
Notice: Each element takes the full width and starts on a new line
</div>
</div>
<div class="section">
<div class="label label-inline">display: inline</div>
<div class="inline-demo">
<span>Inline 1</span>
<span>Inline 2</span>
<span>Inline 3</span>
<span>Inline 4</span>
</div>
<div class="note">
Notice: Elements flow together like text, wrapping when needed
</div>
</div>
<div class="section">
<div class="label label-inline-block">display: inline-block</div>
<div class="inline-block-demo">
<div>Box 1</div>
<div>Box 2</div>
<div>Box 3</div>
<div>Box 4</div>
</div>
<div class="note">
Notice: Elements sit next to each other BUT have set width/height
</div>
</div>
</div>
</body>
</html>Loading preview...
Creates a flexible container for arranging items in one direction
display: flex;Perfect for: Navigation bars, card layouts, centering
Creates a two-dimensional grid system for complex layouts
display: grid;Perfect for: Page layouts, image galleries, dashboards