I'm trying to place a picture on left , and explanation paragraph on the right side , it might be long to exceed the height of that image.
So i put out a minimal test case:
<html>
<head>
<title> This is an demo </title>
<style>
img { float: left; }
</style>
</head>
<body>
<div id="content">
<img src="61add42atw1dnf1k4h4qzj.jpg" />
<p> This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph ..
</p>
</div>
<div id="content">
<img src="61add42atw1dnf1k4h4qzj.jpg" />
<p> This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph .. This is a pretty long paragraph ..
</p>
</div>
</body>
</html>
And the result (Chromium Browser 15) was totally bad:
The second div
overlapped the first one.
P.S: i tried to use a HTML table , but that's not what i wanted , it's better fix my mistake here
Thanks !
You can add a clear:both to the content div
, that way they won't overlap each other.
#content {
clear:both;
}
Also, if you are using #content multiple times you should use a class
instead of an id
. On classes and ids: http://www.tizag.com/cssT/cssid.php