When an element that has the class 'clearfix' touches the bottom of the browser some extra white space appears in between the body and the edge of the browser.
/**
* Markup free clearing.
*
* @see http://perishablepress.com/press/2009/12/06/new-clearfix-hack
*/
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
The only discussion I can find on this issue is here: http://drupal.org/node/281106
After trying a few different things like setting the font size and line height to 0 (as suggested in the previous issue) I found that the only thing that would reliably make the white space go away was to replace the content "." with " " (ie a space instead of a full stop)
To be honest I'm surprised I haven't run into this before, so much so that I assumed there is a valid reason why the clearfix rule is using a full stop instead of a space, especially in light of the fact that the article linked to in the comment uses a space and not a full stop. (http://perishablepress.com/press/2009/12/06/new-clearfix-hack)
I have tested this in Safari, FF, IE6, 7, 8 and Opera and all seem perfectly happy with using a space instead of a full stop.
Can anyone come up with a valid reason that we shouldn't change this?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | clearfix-D7.patch | 917 bytes | droplet |
| #4 | clearfix.patch | 942 bytes | droplet |
| #2 | 1051464-update_clearfix-2.patch | 858 bytes | amateescu |
Comments
Comment #1
sonictruth commentedSo, the clearfix rule would become:
I will roll a patch if no one can come up with an obvious reason why the full stop is a good idea
Comment #2
amateescu commentedActually, a space character is no good either, but i agree that we should definitely update our clearfix. Needs good testing though.
References:
https://github.com/paulirish/html5-boilerplate/blob/master/css/style.css
http://www.yuiblog.com/blog/2010/09/27/clearfix-reloaded-overflowhidden-...
http://blueprintcss.lighthouseapp.com/projects/15318/tickets/5-extra-mar...
Comment #3
sonictruth commentedI'm happy to do whatever the cool kids are doing ;)
Comment #4
droplet commentedthe new clearfix removed font-size:0; and use overflow: hidden; instead of visibility: hidden;
Comment #5
amateescu commentedSure, but still needs a lot of testing :)
Comment #6
droplet commentedsome more cool and new clearfix recently:
http://nicolasgallagher.com/better-float-containment-in-ie/
Comment #7
sunLots of trailing white-space and tabs here.
18 days to next Drupal core point release.
Comment #8
sunActually, marking as duplicate of #961876: Consider new clearfix methods. You can follow up on that issue to track its status instead. If any information from this issue is missing in the other issue, please make sure you provide it over there.