Friday 10 April 2015

How to Clearing floats

A common problem with float-based layouts is that the floats' container doesn't want to stretch up to accomodate the floats. If you want to add, say, a border around all floats (ie. a border around the container) you'll have to command the browsers somehow to stretch up the container all the way.
The problem
Let's try it. This is the CSS we'll use throughout the page:

  1. div.container {
  2. border: 1px solid #000000;
  3. }
  4. div.left {
  5. width: 200px;
  6. float: left;
  7. }
  8. div.right {
  9. width: 200px;
  10. float: right;
  11. }
For such more Blogs you can visit to http://findnerd.com/NerdDigest

No comments:

Post a Comment