What does "clear" do?

liunx

Guest
In this example, what does clear do?

{
width: 100%;
clear: both;
}

Can't seem to find an answer in my "language" at the W3C. In fact, they need a translator at the W3C.

Thanks everyone...

Timclear: both;in that example, clear does nothing. Clear tells an element to clear a floating element (place itself at the bottom of said floating element)In plain English: the clear property tells an HTML tag whether or not stuff can float on either side of it, once displayed on the screen. clear: both; tells the browser to not allow floated elements on the left or right sides of an HTML tag with this property applied. clear: left tells the browser that floated elements may appear on the right side of a tag, but not the left side. The opposite is true for clear: right. The default value for the clear property in all HTML tags is clear: none; - telling the browser that floated elements may appear on both sides of an affected tag.

The reason samij586 said that:

{
width: 100%;
clear: both;
}

doesn't do anything is because whatever HTML tag this get applied to will be 100% the width of whatever contains it. There isn't room to float stuff on either side of an element with 100% width.GREAT thanks... I think the two of you should re-write the W3C CSS section. Your explainations were great. I actually thought that's what it was supposed to do but was unsure until now.

Again, thanks!

TimNo problem.

Oh. And the Red Wings RULE!!He he he he he... Well, the Avalanche s*** as well. I dropped my old screen name cause my team doesn't do any better. Besided, I have a new hockey team to loath, the Canucks (Todd Bertuzzi's team). In fact, I like the Red Wings now.We're just Joshin' ya :D
 
Back
Top