<div class="container">
<p>
Without specifying a width, the element will take up the width of its container, and the content inside it will be bound to that width.
</p>
<div class="element">
<img src="http://tympanus.net/codrops-playground/assets/images/cssref/properties/min-width/kitten.jpeg" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium, vel, minima, quae atque et reprehenderit dolor in consequuntur amet ea ut autem enim laborum culpa nobis cupiditate id velit a!</p>
</div>
<p>
Using <code>max-content</code>, the element will be stretched to fit the width of its content, without breaking the content at any soft breaks. That is, the paragraph will continue as one line, without breaking into multiple lines, and the element must stretch to fit it, and that will be its minimum width.
</p>
<div class="element max-content">
<img src="http://tympanus.net/codrops-playground/assets/images/cssref/properties/min-width/kitten.jpeg" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium, vel, minima, quae atque et reprehenderit dolor in consequuntur amet ea ut autem enim laborum culpa nobis cupiditate id velit a!</p>
</div>
</div>
body {
background-color: #F5F5F5;
color: #555;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.container {
margin: 40px auto;
max-width: 700px;
border: 1px solid #aaa;
padding: 1em;
}
.element {
margin-bottom: 30px;
background-color: white;
padding: 1em;
}
img {
max-width: 200px;
}
.boxSizing {
box-sizing: border-box;
}
.max-content {
min-width: -webkit-max-content;
min-width: -moz-max-content;
min-width: max-content;
}