Hi,
Theres a similar thread here:
http://www.sitepoint.com/forums/showthread.php?t=198583
To clear elements without leaving a gap you can use this clearer style.
Code:
.clearer {
clear:both;
height:1px;
overflow:hidden;
margin-top:-1px;
}
Code:
<div class="clearer"></div>
or even
Code:
<br class="clearer" />
However you can simplify your code and get rid of all those clearer divs by just floating one element and simplifying the mark up at the same time.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
ul#list, #list li{
margin:0;
padding:0;
list-style:none;
text-align:right;
}
ul#list li span{float:left}
</style>
</head>
<body>
<ul id="list">
<li><span>Year:</span>1995</li>
<li><span>Make:</span>BMW</li>
<li><span>Model:</span>525i</li>
<li><span>Mileage:</span>30,565</li>
<li><span>Asking Price:</span>$19,555</li>
</ul>
</body>
</html>
Hope that helps.
Paul
Paul
Bookmarks