Activity Stream
48,167 MEMBERS
6892 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 10 of 10
  1.     
    #1
    Member

    Default The modern ClearFix

    Many people here still use 10 years old method to clear floats aka ClearFix, using markup. Which is a terrible coding practice.
    ( something like.. <div class='clearfix'></div> )

    So had to share the better way of doing that using CSS psuedo elements:-

    Code: 
    .clearfix:after{
      clear: both;
      content: "";
      display: block;
    }
    Just put this code in your stylesheet and apply 'clearfix' class to the parent element.

    Live Demo: http://jsfiddle.net/ccxRJ/1/embedded/result/

    Compatibility: IE8+, FF3.5+, Safari 1.3+, Opera 9.5+ and Google Chrome 2+

    There is another method but is often problematic:-

    Code: 
    .clearfix {
        overflow: hidden;
    }
    That's all folks, enjoy

    P.S: if u don't know what is ClearFix then this tutorial is not for you.
    SalmanAbbas007 Reviewed by SalmanAbbas007 on . The modern way to clear floats Many people here still use 10 years old method to clear floats aka ClearFix, using markup. Which is a terrible coding practice. ( something like.. <div class='clearfix'></div> :|) So had to share the better way of doing that using CSS psuedo elements:- .clearfix:after{ clear: both; content: ""; display: block; } Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Thanks. I didn't know about :after. What else can you use it for?

  4.     
    #3
    Member
    Website's:
    HenchFile.com
    Thanks for that .

    This is a much better way than I use at the moment. Saved in my fav's

  5.     
    #4
    Member
    You're welcome @magca and @papa_face.

    Quote Originally Posted by magca View Post
    Thanks. I didn't know about :after. What else can you use it for?
    :before and :after are used to add a pseudo-element before and after an element using css while keeping your markup clean.
    So a lot of tricks possible We can use them for multiple bgs and borders, see here.

  6.     
    #5
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    This has been around since CSS2 but using clear divs or applying the 'clear' attribute correctly is still preferred because the ':after' pseudo-element is not supported before IE8 and in older versions of other browsers.

    So until everyone stops using IE6 and IE7, professional websites will continue to manage without ':after'.

    Same issue with 'content:'.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  7.     
    #6
    Probation
    Gooood

  8.     
    #7
    Member
    Quote Originally Posted by JmZ View Post
    This has been around since CSS2 but using clear divs or applying the 'clear' attribute correctly is still preferred because the ':after' pseudo-element is not supported before IE8 and in older versions of other browsers.

    So until everyone stops using IE6 and IE7, professional websites will continue to manage without ':after'.

    Same issue with 'content:'.
    Yeah these are part of the CSS2.1 spec
    Though most people have stopped supporting these old and buggy browsers. Even Twitter, Digg, Youtube and Facebook. And even Microsoft hates IE6 and wants to get rid of it
    Personally I prefer to show a message to IE6,7 users asking to install an 'additional plugin', ChromeFrame(Webkit goodness in IE ) or use a modern browser.
    IMO only Governmental or similar sites will want to support these ancient browsers now. ffs its 2011

  9.     
    #8
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    They want to get rid of IE6 and have almost succeeded.

    IE8 was only released in 09 so IE7 is still used by a lot of people and is still widely supported. The top few websites aren't 'most people', most of the web tries to support IE7 at least.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  10.     
    #9
    Banned
    Website's:
    Khambaty.com iMotivate.net
    I still know more then 10 people who are uber noobs at computers and use IE6 and when I told them to upgrade , they said no , my computer will be spoiled

  11.     
    #10
    Member
    Quote Originally Posted by JmZ View Post
    They want to get rid of IE6 and have almost succeeded.

    IE8 was only released in 09 so IE7 is still used by a lot of people and is still widely supported. The top few websites aren't 'most people', most of the web tries to support IE7 at least.
    yeah true, it still has 7% marketshare

    @Netguy lol

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to clear your DNS cache
    By Areon in forum Server Management
    Replies: 0
    Last Post: 1st Mar 2014, 10:24 AM
  2. Boxbilling Clear-Up
    By junjunjun in forum Webmaster Discussion
    Replies: 1
    Last Post: 24th Aug 2012, 08:27 AM
  3. Clear .txt files
    By viruz99 in forum General Discussion
    Replies: 6
    Last Post: 23rd Dec 2011, 08:29 AM
  4. Please clear this up for me
    By priviet02 in forum Legal Issues
    Replies: 8
    Last Post: 23rd Sep 2008, 01:45 AM

Tags for this Thread

BE SOCIAL