I have several divthat contain a floating image and an unordered list. I want both to sit side by side down the page.
The problem is that as it divgoes down the page, it all falls apart. The images on the right begin to decline and fall, and the list items go higher and higher. Here is what I did.
.imageleft {
float: left;
margin-left: 0;
margin-top: 0;
}
.container-right {
display:inline;
padding-bottom: 10px;
width: 500px;
}
.container-left {
float:left;
padding-bottom: 10px;
width: 500px;
}
<div class="inline">
<div class="container-left">
<img alt="Image info" class="imageleft" src="someimage.png" />
<h3>
Title</h3>
<ul>
Sub title:
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
</ul>
</div>
<div class="container-right">
<img alt="Blah blah" class="imageleft" src="/another-image.png" />
<h3>
Title</h3>
<ul>
Sub heading
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
<li>
List item</li>
</ul>
</div>
</div>
I tried adding divaround 2 div, but it doesn't seem to help. How can I prevent this unwanted behavior?
Thanks for any tips!
source
share