Web Design Forum: Clear in CSS - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Clear in CSS

#1 User is offline   tigerlabs 

  • Dev Ninja
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,462
  • Joined: 09-January 08
  • Reputation: 3
  • Gender:Male
  • Location:United States
  • Experience:Advanced
  • Area of Expertise:Coder

Posted 09 February 2009 - 08:47 PM

Would someone explain in as simple terms as they can what
clear
does in css?


Thanks a lot.


EDIT: I've had a look at W3 Schools but I just don't get it..... Hoping someone here can explain it better?
0

#2 User is online   Dizi 

  • Queen of the Spammers
  • PipPipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 5,639
  • Joined: 13-August 07
  • Reputation: 156
  • Gender:Female
  • Location:Newcastle, UK
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 09 February 2009 - 08:56 PM

clear helps to clear floats, is that simple enough terminology :pp

J/k
http://www.w3.org/TR...ml#flow-control

That should explain it for you :)
0

#3 User is online   Dizi 

  • Queen of the Spammers
  • PipPipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 5,639
  • Joined: 13-August 07
  • Reputation: 156
  • Gender:Female
  • Location:Newcastle, UK
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 09 February 2009 - 08:59 PM

ohh ok then I guess i need to try and explain it now....errr 2 seconds :pp



EDIT:

Say you have a box that is floated on the left and then you have another box that you are also floating left, however you don't want these two boxes to be sitting next to each other, in the second boxes css you can say clear:left; which will mean that anything floating to the left that is before the second box (ie the first box) will sit above the second box rather than next to it.

So clear left clears floats to the left of the box in question,
clear right clears floats to the right of the box in question (if box one was floating on the right)
Clear both would clear both left and right floating boxes.


The best way to understand it would be to actually mess about with two floating boxes and see the effect that each has...like this for example:

#one {
width:100px;
height:100px;
float:left}

#two {
width:100px;
height:100px;
float:left;
clear:left;}



<div id="one"></div>
<div id="two"></div>



Hope that makes a bit of sense.
0

#4 User is offline   tigerlabs 

  • Dev Ninja
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,462
  • Joined: 09-January 08
  • Reputation: 3
  • Gender:Male
  • Location:United States
  • Experience:Advanced
  • Area of Expertise:Coder

Posted 09 February 2009 - 10:58 PM

Goodie! Thanks Dizi, sorry for being such an idiot.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users