Forums

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

Home Forums CSS New clearfix method with pseudo elements, not working for me?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #38451
    Devotee
    Member

    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?

    #104184
    wolfcry911
    Participant

    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.

    #104187
    wolfcry911
    Participant

    you only need the clear: both if they’re floats

    #104200
    wolfcry911
    Participant

    well if they’re floats, you don’t need display: block;

    #104465
    Devotee
    Member

    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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.