Grow your CSS skills. Land your dream job.

My first go at clearfixing Not sure if done right

  • # May 23, 2013 at 11:00 pm

    I have my my own grid system with clearfix for my footer have never use clearfix before would like to know if done correct?

    http://codepen.io/mwbcomputers/pen/jwFyD

    # May 24, 2013 at 12:21 am

    @mwbcomputers, not to bad, i made a few changes and forked it here. Also, check out Chris Coyier’s article about Don’t over think it grids.

    # May 24, 2013 at 6:56 am

    you don’t need the clearfix on each box – just the parent. Perhaps you prefer the modular css and many classes (I don’t), but you can reduce and reuse classes (box 1 and 3 are the same as well as box 2 and 4). I would definitely _not_ use the clearing method John uses above in his fork. There is absolutely no reason to use the universal selector and add garbage to every element on the page. Please know that there a multiple ways of containing floats, and which one you choose will (or should) depend on the situation. The clearfix method is a very good choice most of the time, but I still prefer overflow:hidden.

    Here’s my fork showing how this can be done without a single class (just as a proof of concept)

    http://codepen.io/wolfcry911/pen/qkyEd

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".