Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS So I ran some of my code through W3C’s validator…….. Re: So I ran some of my code through W3C’s validator……..

#127590
Merri
Participant

Clearfixes you can or can’t use with a menu:

/* can’t use this – you won’t see the child dropdowns as they go outside UL! */
ul {
overflow: hidden;
}

/* pseudo clearfix element */
ul {
width: 100%; /* give any width (to trigger hasLayout in older IEs, gives the same end result) */
}
ul:after {
clear: both;
content: ”;
display: block;
}

I find it a bit odd people keep on writing their CSS-minded elements and attributes in HTML. I mean things like this:


Personally I rather just keep it all in CSS and not add extra stuff to HTML just because I need a clearfix.