Display Property (block, inline, inline-block):
- It controls how an element is shown on the page.
Block:
- Element takes full width.
- Starts on a new line.
<div>Block 1</div>
<div>Block 2</div>
div {
display: block;
background-color: lightblue;
}
Inline:
Elements stays in same line.
Takes only required width.
<span>Span 1</span>
span {
display: block;
background-color: lightgreen;
}
Top comments (0)