I am trying to place two divs horizontally, but the content of the second div exceeds the height of the first, I get bad results:
Here is my HTML code:
<html> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="mystyle.css"></head> <body> <div class="container"> <div class="yellow">sometext</div> <div class="green">more text here more text here more text here more text here more text here more text here more text here more text here more text here more text here </div> <div class="spacer"></div> </div> </body>
and this is my css:
.yellow { background-color: yellow; margin: 2px; float: left; width: 100px; text-align: center; } .green{ background-color: #00ff00; } .container { width: 30%; } .spacer { clear: both; }
As a result, I want:

but this is what I get:

source share