Articles
css
How to make a div fit the size of its childrencss

You can make a div fit the size of its children by using display: inline-block

Example Usage

<div style="display:inline-block"><!--  this div will be same size as its child -->
    <p style="width:200px;height 500px;">some content</p>
</div>

Using display:inline-block

some text
hello

Without display:inline-block

some text
hello