Sometimes, we want to make element display block without 100% width with CSS
In this article, we’ll look at how to make element display block without 100% width with CSS.
How to make element display block without 100% width with CSS?
To make element display block without 100% width with CSS, we make it an inline block element.
For instance, we write
<div class="row">
<div class="cell">Content</div>
</div>
<div class="row">
<div class="cell">Content</div>
</div>
to add some divs.
Then we write
.cell {
display: inline-block;
}
to make the divs with class cell
inline block elements with display: inline-block;
.
Conclusion
To make element display block without 100% width with CSS, we make it an inline block element.