/    Sign up×
Community /Pin to ProfileBookmark

What does "clear" do?

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…

Tim[COLOR=red]clear: both;[/COLOR]

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@SamMay 13.2004 — in that example, clear does nothing. Clear tells an element to clear a floating element (place itself at the bottom of said floating element)
Copy linkTweet thisAlerts:
@toicontienMay 14.2004 — 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:
<i>
</i>{
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.
Copy linkTweet thisAlerts:
@RedWingsSuxauthorMay 14.2004 — 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!

Tim
Copy linkTweet thisAlerts:
@toicontienMay 14.2004 — No problem.

Oh. And the Red Wings RULE!!
Copy linkTweet thisAlerts:
@NorskMay 14.2004 — 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.
Copy linkTweet thisAlerts:
@toicontienMay 17.2004 — We're just Joshin' ya ?
×

Success!

Help @RedWingsSux spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...