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

Home Forums CSS Clearing Divs Question

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #44957

    I know a bit about clear divs but just have a couple of questions.

    Sometimes in my html I put in between the last div and start of a new div I create a div class of clear.

    is it best to create a class for clear on html or just add it to parent class css example .nav


    I think you’ll find most people prefer to use the *clearfix* method:


    @mwbcomputers I’ve been using this as of recent:

    element:after {
    content: "";
    display: table;
    clear: both;

    I got the idea from Chris Coyier’s article here.

    Personally, i wouldn’t add extra markup to clear a float just use pseudos like :after.


    Thanks will watch some videos on you tube about. its juts I am creating a eight column footer 4 on top and 4 below. I have heard about clear fix but never understood it. will give it ago.


    You can target a specific child element such as the following, This will target only the fifth column and clear the float left, This is being really specific and avoids uneccassry classes, ids or other tags.



    footer .column:nth-child(5) {
    clear: left;

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