Careeroza
display
The display Property
| Value | Behaviour |
|---|---|
block | new line, full width; width/height apply |
inline | flows in text; width/height ignored |
inline-block | flows in text, but width/height/padding apply |
none | removed from the page completely |
flex / grid | layout containers (Medium level) |
Example
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
span { background: #d0ebff; padding: 4px; }
.ib { display: inline-block; width: 90px; height: 40px; background: #d3f9d8; }
.blk { display: block; background: #ffe8cc; }
.hidden { display: none; }
</style>
</head>
<body>
<p>inline: <span>one</span> <span>two</span></p>
<p>inline-block: <span class="ib">90×40</span> <span class="ib">90×40</span></p>
<p>block: <span class="blk">I take a full line</span></p>
<p>none: <span class="hidden">you cannot see me</span>(hidden)</p>
</body>
</html>Result
Note: visibility: hidden hides an element but keeps its space; display: none removes the space too.