Results 1 to 10 of 10
-
28th Apr 2011, 01:21 AM #1OPMember
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; }
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; }
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
-
28th Apr 2011, 06:23 AM #2Member
Thanks. I didn't know about :after. What else can you use it for?
-
28th Apr 2011, 07:53 PM #3MemberWebsite's:
HenchFile.comThanks for that
.
This is a much better way than I use at the moment. Saved in my fav's
-
29th Apr 2011, 11:28 AM #4OPMember
-
29th Apr 2011, 12:19 PM #5(╯?□?)╯︵ ┻━┻Website's:
Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.comThis 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!
-
29th Apr 2011, 06:41 PM #6Probation
Gooood
-
30th Apr 2011, 12:37 AM #7OPMember
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
-
30th Apr 2011, 05:31 PM #8(╯?□?)╯︵ ┻━┻Website's:
Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.comThey 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!
-
30th Apr 2011, 06:42 PM #9BannedWebsite's:
Khambaty.com iMotivate.netI 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
-
1st May 2011, 06:19 AM #10
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
How to clear your DNS cache
By Areon in forum Server ManagementReplies: 0Last Post: 1st Mar 2014, 10:24 AM -
Boxbilling Clear-Up
By junjunjun in forum Webmaster DiscussionReplies: 1Last Post: 24th Aug 2012, 08:27 AM -
Clear .txt files
By viruz99 in forum General DiscussionReplies: 6Last Post: 23rd Dec 2011, 08:29 AM -
Please clear this up for me
By priviet02 in forum Legal IssuesReplies: 8Last Post: 23rd Sep 2008, 01:45 AM
themaCreator - create posts from...
Version 3.55 released. Open older version (or...