- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Trying out new clearfix method with generated pseudo elements. Each box has a clearfix, should they not line up underneath each other instead of floating like usual?
http://johandahl.com/wp/portfolio/
Whats wrong?
What is it you’re trying to achieve? Divs by default are block level and would fall beneath one another naturally. Then you’ve set them to display: table which would do the same thing but change other characteristics. But that doesn’t matter because you’ve then overridden that with the floats. And now you want each float to clear the previous… why bother?
Do you understand what the clearfix method is for? It seems like you’re using it where a simple clear: left (or clear: both) would suffice. At any rate the reason things aren’t working as you would like is that the psuedo elements are children of the element and therefor are in a different layout context than the floating boxes.
you only need the clear: both if they’re floats
well if they’re floats, you don’t need display: block;
Oh, wolfcry is right I mistook the clearfix method for a simple clear:left/both.
Regarding the display:table, that was to vertically align the text on the boxes.
Thanks for clearing this up for me.