Use clear div as the divider : clear : Layout HTML CSS TUTORIALS


HTML CSS TUTORIALS » Layout » clear »

 

Use clear div as the divider


 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Enclosing Floats</title>
<style type="text/css">
.clear {
  clear: both;
}

.news {
  background-color:#eaeaea;
  border: solid 1px #999;
  width: 500px;
  margin-top: 10px;
}

.news img {
  float: left;
  padding: 10px 0 10px 10px;
}

.news p {
  float: right;
  width: 350px;
  margin: 0;
  padding: 10px 10px 10px 0;
}

.clearfix:after {
  content: ".";
  height: 0;
  visibility: hidden;
  display: block;
  clear: both;
}
</style>
</head>

<body>

<div class="news">
<p>day.</p>
</div>

<div class="clear">ads</div>

<div class="news">
<p>day.</p>
<div class="clear"></div>
</div>
<div class="news clearfix">
<p class="">day.</p>
</div>
<p>Blah, blah</p>
</body>
</html>

 



HTML code for linking to this page:

Follow Navioo On Twitter

HTML CSS TUTORIALS

 Navioo Layout
» clear