Make div block not auto stretch to container width

Okay now what if, you have a container and place a div in it and this div auto stretches to the full width of the container. What if you don’t want that?

What do you have to do if you don’t want to make a block stretch to it’s container width? Simple, you edit your css style sheet and change the display: block to inline-block for the child element.

So you have a container and a div. Set the display property of the div to inline-block;


display: inline-block;