I'm using inline-block elements instead of floats to have a responsive box grid. When the elements are inline, the wrapper width works fine. When they shift to being vertical, the width of the wrapper expands to the width of its container instead of collapsing to the child width. Is there any hope for this?
Here's the code:
HTML:
<div class="container">
<div class="wrapper">
<div class="item item1">
<img src="http://www.noupe.com/wp-content/uploads/trans/wp-content/uploads/2010/07/th_IMG_1826s.jpg" />
</div>
<div class="item item2">
<h2>Text Div</h2>
<ul>
<li>Item one</li>
<li>Item two</li>
</ul>
</div>
</div>
CSS:
img {
width: 325px;
height: auto;
}
div.container {
display:block;
width: 100%;
max-width: 1000px;
}
div.wrapper {
display: inline-block;
background: #544;
text-align: center;
padding: 15px;
}
div.item {
display:inline-block;
width: 325px;
}
If I remove the img div, the wrapper works perfectly. I feel like I'm missing something very obvious.
EDIT: Forgot the jsfiddle: http://jsfiddle.net/U3hus/13/