margin-top not working with clear: both

You could put the two floated divs into another one that’s got “overflow: hidden” set: <div style=”overflow:hidden”> <div style=”float: left;”>Left</div> <div style=”float: right;”>Right</div> </div> <div style=”clear: both; margin-top: 200px;”>Main Data</div> edit — To add a bit to this 5-year-old answer: I think the cause of the confusing behavior is the somewhat complicated process of margin … Read more

CSS Float Logic

Here’s the part of the linked answer that’s most relevant to your question: When you float a block element, you are telling the browser to position it next to the previous floated object, so long as the container is wide enough (otherwise it will drop below the previous object). As the author mentions this is … Read more

Aligning two divs side-by-side [duplicate]

If you wrapped your divs, like this: <div id=”main”> <div id=”sidebar”></div> <div id=”page-wrap”></div> </div> You could use this styling: #main { width: 800px; margin: 0 auto; } #sidebar { width: 200px; height: 400px; background: red; float: left; } #page-wrap { width: 600px; background: #ffffff; height: 400px; margin-left: 200px; } This is a slightly different look … Read more

CSS Float: Floating an image to the left of the text

Is this what you’re after? I changed your title into a h3 (header) tag, because it’s a more semantic choice than using a div. Live Demo #1 Live Demo #2 (with header at top, not sure if you wanted that) HTML: <div class=”post-container”> <div class=”post-thumb”><img src=”http://dummyimage.com/200×200/f0f/fff” /></div> <div class=”post-content”> <h3 class=”post-title”>Post title</h3> <p>post desc post … Read more