Ads Below Title
Ads Inside Post
Ads End Post
2017 2018 4G add-ons Android apbn App Apple Application arabic Archaeology Argentina Arrest warrant Arrow keys Artificial Intelligence Artikel Arus Kas aset kripto Asia Assange Associated Press Aston Martin Aston Martin One-77 Astronomical unit Asyar Atlantis Audi Audi A5 Audi Q7 Australia Austria auto like Automobile Autos Avaya Device Manager Azwar Abubakar B. J. Habibie bacaan tahlil Bachelor's degree Backup badan pengawasan obat bius Badan Pusat Statistik Badanan Bagi Bali Ballmer Bandung Bandwidth Tests Bangkalan Bank Indonesia Banner Baptists Barack Obama Barbie Baru BASIC bbc Beauty pageant Bedework Bedework beginner Belum Beri Berpura BI Biar Biasanya Bilbo Baggins bima sakti Binance Bisnis Bitcoin Biz Stone BJ Habibie BKN BKPM BlackBerry BlackBerry PlayBook Blackpool Blog Blogger Blogger help Blur (band) BNI BNN Bob Hasan Boeing Bogor Bom BonJovi Bonus 1GB Bonus Data Bonus Smartfren Borobudur BPK Brain Bridget Firtle Britney Spears Broadband Broadband Internet access Browser Brunei Bruno Mars Brussels BSE Buah Ape Bubarkan PKS Buddhism Budidaya Buenos Aires Bugatti Veyron BugattiVeyron Bugzilla Bukittinggi bumi Bureau of Labor Statistics Burma Busdiness Business Business and Economy Business school BY COUNTRY Cable television Calendar California capres 2014 Car Cara Cara Mencari Kerja Cara Menjual Diri Cara Menulis Cara Menulis Resume cars Cascading Style Sheets Cash conversion cycle CBS News CCC CD ripper CDDB Central Authentication Service Central Java Chairul Saleh Chania Chat room Chester Chief Digital Offers Chief marketing officer Chile China Cho Kyuhyun Chris Johns Christine Quinn Chuck Hagel Cisco PIX Classified information Clients Climate change Clothing CMO CMOs cms CNET.com CNN Coba CoffeeScript Cognition Collecting Colleges and Universities Colotomy Combinatorics Community Compact Disc Companies Company Comparison of antivirus software Computer crime Computer file Computers and Internet Connect Content management system Contoh Proposal Control key Corruption Eradication Commission Counties CPN CPNS CPNS 2013 Crack epidemic (United States) Create Crime Cryptocurrency CSS Current account Customer Customer service CV DA2 Daerah Dalam Dalat Dalcroze Eurhythmics Dallas Dan Dan (rank) Dangdut Academy2 Dangdut Akademi2 Daniel Tal Daniele De Rossi Danny Quirk Dari Data center Data Communications Database administrator Dating Daun kelor Dead Space 2 Death Debu Decision making Default (finance) Definisi Deforestation in Indonesia Dell Dell inspiron N4010 Drivers For Windows 7 (32bit) Democracy Democratic Design & Printing Dessau Device driver Device Drivers devisit Dick Costolo Digital Clock Digital distribution Digital marketing Digital photography Digital Subscriber Line Digital System Dire Straits Disk Management Distilleries DNS DNS hosting service DNS Server Dolls Domain name Domain Name System Dompet Donald Benek DoubleClick DoubleClick Insights Dow Jones Industrial Average download Download Driver LapTop Download manager DownThemAll DPR driver canon Drivers Drupal Drupal Planet Dubai Duduk Duhur Dunayevskaya Raya DVD Dynamic Views E-book East Java East Nusa Tenggara Economy ecstasy Education Edward Snowden Efficient Cars Eid al-Adha Eid al-Fitr Eid ul-Fitr Ekonomi Embassies and Consulates Embraer Regional Jet Émile Jaques-Dalcroze Employee Empowerment Employment Enable Flas Player Energy Alternatif Energy minister EPUB Eropa Erwin Arnada European Central Bank European Commission European Parliament European Union Evan Williams Evi Juara DA2 Evi Masamba Evil Bong EXO exo planet expensive expensive cars expensive cars 2013 expensive cars speed Experience point F. W. de Klerk Facebook Facebook Graph Search Federal Reserve System Ferrari Ferrari 458 Italia Ferrari Enzo FIA Fianna Fáil File Management File Transfer Protocol Filipina Financial Aid Firefox Firefox 3.5 Firefox 3.6 FLAC Flas Player Flax Flipcard Floor trader FM Transmitter font Food and Drink Ford Fusion Forest FPI Fred Phelps Free Free content free hosting Free Proxy Free Proxy Lists FreeDB FreeSat TV Freeware Frekuensi friend FriendFeed Fujian Game design Games Ganjar Garuda Garuda Indonesia Gaussian blur Gautama Buddha Gaya Hidup Gaza Gerindra Germany Daun Ghalib Github Global navigation satellite system Global Newsbeat Global Redirect Glossarium Glutinous rice Gmail GNU General Public License Golden Globe Award Goldman Sachs Golkar Google Google Analytics Google Docs Google Friend Connect Google Search Google Translate Google+ Government Government Issues Grafena Graffiti Grand Final DA2 Grandma Grandparent Graph Search Graphics Graphics processing unit Gratis Greasemonkey Greenhouse gas GROW Guy Rosen GYM Habibie Hacker Hagel Hagen Haiti Hal Halley Halley's Comet Hallo Halloween Hambalang Hamster Handhelds Hank Johnson Hard disk drive Hardware Hari Hars Haryono Suyono HCL Technologies Helmi Johannes Hendarman Supandji Hennessey Venom GT heroin Hewlett-Packard Hibrid High-definition television Hindia Belanda History History of Java Hitung Mundur Pilkada Hobbit Holly Qur'an Hollywood Home Honda Honda Accord Hongkong Hosted Proxy Services Hosting hosting gratis Hosts HOTBISNIS HotBot HOTINFO Hotmail How Search Works How To HTML HTML element HTTP cookie HTTP Secure HTTrack Huffington Post Hulu Human resources Humboldt huruf Hypertext Transfer Protocol Hyundai Sonata Ian Richardson Ibukota Baru ICQ Idaho Falls Idul Adha Idul Fitri Idul Fitri 1435H Ijin Iklan iMacros Image Imsak Income India Indonesia Indonesian Aerospace Indonesian Democratic Party – Struggle Indonesian National Armed Forces Indonesian rupiah Indonesian Ulema Council Indosiar Indro Infiniti Information retrieval Information Technology inggris INI file Ink cartridge Inkatha Freedom Party inovator Insomnia Inspiron Instant messaging Insulators Intel Core Intel Core i7 Intel Corporation intermediate Internal internasional International Monetary Fund International Whaling Commission InternationalSpaceStation Internet Internet access Internet Connect Internet Download Manager Internet Explorer Internet Gratis Internet Phone Internet Protocol Internet safety Internet service provider Internet television Investigasi Investing Investor Investor Awal IOS IP address ip2700 IPad IPhone iPhone terbaik IPsec Iptek Iran Iron Man 3 Islam Islamic Defender Front Islamic Defenders Front Israel Isya Jack Dorsey Jacques-Dalcroze JADWAL IMSAK 2016 JADWAL SELEKSI CPNS Jakarta Jakarta Globe James Brooke Jamur Tiram Japan Jateng Java Java Development Kit Java version history Java virtual machine JavaScript Jawa Timur Jendela jenis proxy Jika Jika Anda jobs Joe Biden Johannesburg Join the Conversation Joko Widodo Jokowi Joseph McBrennan JPEG JRE Juara DA2 Juara Dangdut Akademi 2 Juga Juli Julian Assange Juru Justin Timberlake Jusuf Kalla Kalau Kali Kam Kami Kapal Selam Karena Kata Keamanan Kedua kehidupan Kekuatan sinyal Kelas 3 Kemanusiaan Yang Adil dan Beradab Kenapa Kesehatan Kesra Ketiga Ketika Ketuhanan Yang Maha Esa Ketupat Kíla Kilas VOA Kinetic Energy Recovery System Kini Kita Knowledge Graph Koenigsegg Koenigsegg Agera Koenigsegg CCX Koenigsegg CCXR Koenigsegg Trevita kokain Komet Koneksi nirkabel Konflik Konser Kemenangan DA2 Korea koruptor Kota Rajasthan KPU kriminal Kripto Krishna Kristiani Herawati Krystal Jung KSPI Kung Fu Kupang l Sony Lagu Evi Masamba Lamborghini Lamborghini Aventador Lamborghini Reventón land grabs Languages Laporan Arus Kas Laporan Keuangan Layer 2 Tunneling Protocol LCGC LEBARAN Lemsaneg Leopard Let Me Try Libre knowledge like Likuiditas link Link Building link friend linkedin Linux List of Buddhist temples List of countries by oil production List of Empire ships (Sa–Sh) List of PDF software List of petroleum companies LittleBigPlanet LittleBigPlanet 2 Lodging Login Lokal Lord of the Rings Los Angeles Lost Civilizations Mac OS X Mac OS X Leopard Macintosh Macklemore MacOS Magelang Maghrib Maharaja Mailing list Majapahit makanan Makes and Models Malang Malaysia Malicious Software Maná Management Mandela Marc Brackett Marine biology Marine Ecology Progress Series Mario Mark Zuckerberg Market News Market sentiment Marketing Marketing and Advertising Marketing Team Martial Arts Masehi Massachusetts Mata Uang Kripto mata-mata matahari Matematika Math Mbah Google McLaren McLaren F1 McLaren P1 media query MediaTek Megabyte Megawati Megawati Sukarnoputri Membaca Neraca Memory Fox Menjebol Neraca Menulis CV Merdeka Meta Meta element Meta Tags Meteor shower Meteoroid Michael Bloomberg Microsoft Microsoft Internet Explorer Microsoft PowerPoint Microsoft Windows Middle East Mikheil Saakashvili MikroTik Miley Cyrus Military Militer Minta Maaf mirror web Miss World Miss World 2013 Missions mlm Mobil Murah Mobile application development Mobile Computing Mobile device Mobipocket Mobutu Sese Seko Modal Kerja Mohammad Hatta MOHON MAAF LAHIR DAN BATHIN Monorail Moon Moscow most expensive most expensive cars Motivasi Motivation Movies Mozilla Mozilla Firefox Mozilla Project MP3 Mpu Prapanca MS-CHAP MSN MSN Messenger MTV Video Music Award Muara Hati Multifunction printer Multimedia Murah Mural Music Music and Audio Music roll Muslim my blog My Telkomsel Myanmar N4010 Nagarakretagama Nagasaki Name server Namun NASA Nasional National Football League National Geographic National Monument National Security Agency Negara Nelson Mandela Neraca Netscape Network Network Connection New South Wales New York New York City New York City Police Department New York Stock Exchange New York Times News Nigel Dessau Niger Nigeria Nissan Altima Nobel Peace Prize Norwegian Media Authority Notepad Notepad++ November NSA NTLM NU Nudi Nürburgring Nusa Dua Nusantara NYSE NYSE Euronext NYX obat bius sintetik offline browser Ogg Onavo Online online business Online Communities Online dating service Online Education Online shopping Ookla OPEC Open Europe Open source Opera Mobile Operating system Operating Systems opium Oppa Optical fiber Organization Orion Orionid Orton Orton Effect OS X OS-2 Otomotif Owneys Rum Pada Pada (foot) Pagani Zonda PageRank PageSpeed Pakistan Pala Empire Palestina Palestinian people palm oil Pancasila Panduan Panel Para Partai Demokrat Pathauto Pay per click PayPal pbb PC Plus Peat Pelajaran Bsnis pemasaran Pemenang DA2 Pemilu Pen Qur'an Pendorong Pengetahuan Peninsula Valdes Penipuan Penyakit Berbahaya penyelidikan Penyiaran People's Justice Party (Malaysia) Perilaku Persatuan Indonesia Personal computer Personal Learning Network Personally identifiable information Personals Pertama Pertamina Pertukaran pertukaran kripto Peru Perusahaan Listrik Negara Pesawat Tak Berawak Peter Godwin Peternakan Petroleum Petroleum industry Philippines Phnom Penh Photograph PHP Piano Picasa Picasa Web Albums Picnik PILGUB PILGUB 2018 PILGUB JATENG PILKADA PILKADA SERENTAK 2018 Pilpres Pilpres 2014 PKS Korupsi PKS Sarang Koruptor planet Platforms Playboy Playboy Indonesia PlayStation PlayStation 3 PLN Plone Plug-in (computing) Pluit Point-to-Point Tunneling Protocol Pokki Policy Political Philosophers Political Philosophy Political Science Ponsel ponsel terbaik Porsche 918 Portable Document Format Portlet PostgreSQL Postmedia News Pownce PPTP PQ 12 PQ 15 Prabowo Subianto Prajogo Pangestu Prambanan Pratt Institute Presiden Susilo Bambang Yudhoyono Primera Capital print printer printer 3d Product placement Profesional Programming Promo Promote Promotion Proposal Usaha Prose Protocols Provinces Proxify Proxy server Proxying and Filtering Przedsiębiorstwo Komunikacji Samochodowej Public DNS Publik Publishing Publishing and Printing Pulang2 Ganteng Pulau Jawa Purnomo Yusgiantoro Python Qualcomm Quantum Leap Qur'an Digital Quran Rabu 18 Desember 2013 Radio Rakernas Ramadan Randall Miller ransomware Rape Rasio Likuiditas Recreation Reducing Emissions from Deforestation and Forest Degradation Registry cleaner Regulasi Rekap Pilpres 2014 Relationship Religion and Spirituality Repost Resume Resumes and Portfolios Retirement Reuters RF Power Amplifier Rheinmetall Riau Ridwan Robert Kiyosaki Robin Thicke Roboform Roi Tiger Roundtable on Sustainable Palm Oil RTC RTT News rum Rumah Rusia Sabu Safari Salah Sales Sam Hall Samsung Sandy Bridge Sangat (term) Sani Abacha Sapta Pesona satelit Satu Saving Money SBY Puas Scam Scholarship Scintilla Scripts SCTV (Indonesia) SD Sea Lines of Communication Search Search engine optimization Search Engines Searching Secure Socket Tunneling Protocol Security Sejuk Sekolah Olahraga Nasional SELAMAT HARI RAYA IDUL FITRI 1434H Selamat Idul Fitri Selanjutnya SELEKSI CPNS Semarang seo seo service online Seoul September 2013 Serbia Sergei Krikalev Server Sesungguhnya Shareware Shopping Shopping mall Shwedagon Pagoda Siaran Silvio Berlusconi Sime Darby Singapore Single Evi Masamba Single sign-on Site map Site Submission Sitemap skema investasi SlideShare Slideshow SM Entertainment Smartphone Smartphones Smarty Smaug SMV SMV FreeSat TV social bookmark Social media Social Network Social Networking Social Sciences Society Soeharto Soekarno software Solar sail Sosial South Africa Southeast Asia Southern right whale Soviet Union Soweto Space Space Shuttle Discovery Speedtest.net SPN Sports Sports car Sriwijaya Air SSL Stanford University States and Divisions Statistics Indonesia Stephan Winkelmann Stereo FM Transmitter Steve Ballmer Steve McQueen Steven Sinofsky Stock Exchange of Singapore Stock market Streaming media Student Subscriber Identity Module Subuh Suharto Sukanto Tanoto Sukhoi Sumatra Sumatra PDF Super Bowl Superior mesenteric artery Surabaya Surat Susan Boyle Susilo Bambang Yudhoyono Swasta Sweden Switzerland system backup image System Restore T-shirt Tablet Taeyeon tahlil tahlilan Taipan Daily Taiwan Tanah Abang Tapi tata surya Tatto Taylor Swift TeachMeet TechCrunch technology Teknologi teks tahlil Tel Aviv Telepon Gratis Televisi Television Telkomsel Telstra Template Designer Templates Temporary Internet Files Teori Keuangan Terkenal Ternak Ternak Belut Territorial Disputes Testing and Tools Tf–idf Thailand The Noble Experiment Things You Didn't Know About... ThinkPad Thomas Tiffany Tiga Timeline Timor Timor Leste Timur Timur Tengah Tips Tips Kesehatan Tommy Suharto Tony Abbott Toolbar Tools Toyota Toyota Camry Toys Toys and Games Traffic collision Translation Transmitter Transport Layer Security Travel and Tourism trik blog Trowulan Tujuan Wisata tutorial tvone Twentieth Century Twitter U.S. Economy Uang Baru Ulang Tahun Ultraviolet Undang Undang Undang Desa Uniform resource locator United Arab Emirates United States United States Secretary of Defense Universities University of Utah unlimited hosting free Unmanned Untuk update Uploading and downloading UPortal Usaha USB Flash Drive Ustad Ustaz utility UU Desa Valuasi Saham Veggies verification Verizon Fios Veto Video Video game Video Games Virginia Virtual private network virus Vista Vitamin VOA VOA News Voice of America VOIP Volkswagen Group Volkswagen Passat Voltage Regulator VPN VPN Connection Waktu Sholat Washington Washington DC WAV Web browser Web cache Web content management system Web Design and Development Web directory web hosting Web proxy web robot Web search engine Web server Web traffic webmaster tools Website Website Reviews Weekly welcome West Sumatra WETA Digital Whitney Houston Wi-Fi Wibiya Wifi wiki WikiLeak Wikileaks Wikimania Wikimedia Commons Wikimedia Foundation Wilayah Winamp Window 8 Windows Windows 10 Windows 11 Windows 2000 Windows 7 Windows 8 windows 8 backup Windows 8.1 Windows 95 Windows 98 Windows 9x Windows API Windows Media Audio Windows Mobile Windows NT Windows Phone Windows Phone 7 Windows Registry Windows startup process Windows Update Windows Vista Windows XP Wiranto Wireless Data Wisata WordPress World bank Writer Writing x factor Xiaomi Mi5 XML Yahoo Yahoo Messenger Yangon Yogyakarta Yossi Vardi YouTube Yuri Gagarin Zaskia Zemanta ZIP (file format) Zoner Photo Studio ZTE

How To Clear Floats Without Structural Markup

Clearing Floats The Old Fashioned Way

The Suburbs
The Suburbs
When a float is contained within a container box that has a visible border or background, that float does not automatically force the container's bottom edge down as the float is made taller. Instead the float is ignored by the container and will hang down out of the container bottom like a flag. Those familiar only with Explorer for Windows may scratch their heads and say "That's not right!" True, IE/Win does enclose a float within a container 'automatically', but only if the container element happens to possess the MS-only quality called hasLayout.
This float-enclosing behavior in IE can also be 'toggled' off again just by hovering of links within the container, if that hovering alters either the link background or one of several other CSS properties. Quite a mess, and we'll cover it farther along in the article, in the "Toggle Trouble" section.
The W3C suggests placing a "cleared" element last in the container box, which is then recognized by the container height, forcing the container to enclose the float above that cleared element too. It's described more fully our article Float: The Theory:
“..let's say you give that following box the clear property, {clear: both;} . What this does is extend the margin on the top of the cleared box, pushing it down until it "clears" the bottom of the float. In other words, the top margin on the cleared box (no matter what it may have been set to), is increased by the browser, to whatever length is necessary to keep the cleared box below the float.”
So in effect, such a cleared box cannot be at the same horizontal level as a preceding float. It must appear just below that level. The image shows how this might look, with a red border representing the container element:

Shows how a box may clear below a float.
The standard method of making an outer container appear to "enclose" a nested float is to place a complete "cleared" element last in the container, which has the effect of 'dragging' the lower edge of the containing box lower than the float. Thus the float appears to be enclosed within the container even tho it really isn't. The code for a cleared box usually looks something like this:

Since that div is not floated, the container must recognize it and enclose it, and because of that top margin (added by the browser because of the "clear" property), the div "pulls" the bottom edge of the container down below the bottom edge of the float.

Problems With The Method

First and foremost, this clearing method is not at all intuitive, requiring an extra element be added to the markup. One of the major premises of CSS is that it helps reduce the bloated HTML markup found it the average site these days. So having to re-bloat the markup just so floats can be kept within their containers is not an ideal arrangement.
Besides that, some browsers can have trouble with certain kinds of clearing elements in some situations. Mozilla is particularly sensitive to clearing problems.
Up 'til now there was no other way to do this, but no more! Thanks to the efforts of Tony Aslett, creator and operator of csscreator.com, we can now use advanced CSS to "clear" a float container in non-IE browsers and just let IE keep wrongly clearing itself. The upshot is that we now have the option to avoid adding that pesky clearing element to the HTML markup. Woohoo!

"Clearing", 21st Century Style

In the new method, no clearing element is used. This does not affect IE/Win which simply keeps enclosing the float as always (assuming the container has a stated dimension), but non-IE browsers will need a substitute for that element. Here's how it's done.

Using :after

This CSS 2 property allows extra content to be added at the end of an element via the CSS. That means no actual markup is needed in the HTML. The content is specified from within the CSS stylesheet, and appears in the page as would a real HTML element that had been inserted following all the normal content of the target element. Such :after generated content cannot receive some CSS properties, including 'position', 'float', list properties, and table properties. However, the 'clear' property is allowed. Do you see where we are going here?
Imagine that we use :after to insert a simple character like a 'period', and then give that generated element {clear: both;} . That's all you really need to do the job, but no one wants a line space messing up the end of their clean container box, so we also use {height: 0;} and {visibility: hidden;} to keep our period from showing.

Notice that {display: block;} is also applied to the :after element, because if it isn't then that element defaults to "inline", and cannot receive the "clear" property. Also, Tony's method originally used "overflow: hidden;" to hide the period, but sadly the latest FireFox versions will display the period if this is done.

But what about IE?

Since IE7 does not support the :after pseudoclass yet, we must rely on the same"auto-clearing" effect used for IE6, and that behavior happens when the float-containing element gets hasLayout applied to it. A simple declaration of "zoom: 1;" will perform this trick in IE5.5 and up, but it's proprietary and needs to be hidden in order to validate.
As a side benefit, hasLayout on float-enclosing elements also prevents several other major IE/Win float bugs. However, should this container box be placed following a previous external float, the IE height fix will trigger Microsoft's proprietary and illegal Float Model, so watch out for that, okay?

Toggle Trouble

It so happens that IE has, well, a little problem with this auto-enclosing behavior. You saw that coming, didn't you. Yes, IE bugs come in big bunches. This one results when that container element has links inside, following the float. When this happens and certain links are hovered, the auto-enclosing behavior is toggled or "switched off", causing the lower edge of the container box to suddenly jump up to the bottom of the non-floated content. Hovering other links restores the behavior. This interesting effect is of course called the IE/Win Guillotine Bug Those of you viewing in IE/Win may play around with the following live demos, and for a more complete explanation see the IE/Win Guillotine Bug demo page .
The toggling only occurs when a:hover is used to change the link background or many other styling changes, such as padding, margin, or any font styling on the link. Strangely, having the text color change on hover does not toggle the bug.
The containers are grey with green borders, and the floats are dark brown with yellow borders. Notice how the third and fourth links ouside the floats toggle the Guillotine Bug, and the first two un-toggle it. This seems to be related to the actual text lines themselves, so any links after the first two lines will toggle the effect. Links in the float will all un-toggle the effect. Just more weird IE bug behaviors, folks, nothing "unusual".
Screenshot
Float Link Any link in this float will restore the cutoff portion, as will the links in the first two text lines outside the float. Something makes those first two lines "special".
Link Link Link Link
Float Link The non-floated links to the left are wrapped in a paragraph, and that paragraph has the Holly hack value applied to it. Say "buh-bye" to the Guillotine Bug!
Link Link Link Link The second demo has been "fixed" by placing those links in a paragraph, which then gets the zoom fix applied to it. Any block element will do just as well here. Yes, this means another element is needed, but unlike a clearing div, this paragraph is a "semantic" element. Text content really ought to be wrapped in semantic containers anyway, and since we forward-thinking coders always have our content thusly contained, it's easy to apply the same .clearfix class to one more element.

A Word About Floats In Floats

Observant readers will have noticed that the above demos have "enclosed" floats, even in Opera 7 and Mozilla! This is because the demos themselves are floats, and all modern browsers (including IE, luckily) always let floats enclose other floats. Of course there has to be an outer float, and it still threatens to break out of its container...

Putting It Together

First, this code gets added to the CSS stylesheet:
For the HTML, just add a class of .clearfix to any element containing a float needing to be cleared, plus any Guillotine-Bug-fixing block elements within the container. That's it! It's not perfect, but it's a whole lot better than adding an entire extra 'dummy' element. Check out this live demo of the fix in action: This float is not enclosed by the surrounding div container.
This container lacks the fix.
See how this float no longer protrudes out of the containing box, with no extra clearing element used in the container!
This float container has a class attribute of "clearfix", which applies the :after fix, or the Holly hack, depending on the browser.

IE/Mac Strikes Back

All this is wonderful, but unfortunately IE for the Mac does not "auto-clear" floats, and also does not support :after, and so is left out of the clearing party. What's to be done?
You might callously abandon IE/Mac, but consider that many people who use older Macs can't run Safari, or several other modern browsers. Thankfully this browser has been dropped by Microsoft, and at some future time the numbers of such IE/Mac users will become miniscule. Remember that even if a float appears to stick out of a container, no content will actually be obscured. It just won't look as pretty for those few viewers, that's all. Each author will have to decide on this issue according to their specific needs.
This page once described a Javascript method to force compliance in IE/Mac, but now thanks to Mark Hadley and Matt Keogh it's now possible to dispense with that ugly Javascript and go with a straight CSS fix. Woohoo!

Taming the IE/Mac Float Problem

Basically the fix is just a matter of applying a display: inline-block; to the .clearfix class, and hiding that property from all other browsers. That's it! We can easily do this with our existing code, slightly modified.

The .clearfix {display: inline-block;} is seen by all browsers, and fixes IE/Mac. Then, inside the rule set that is hidden from IE/Mac, the display is reset to block. That's all she wrote! Simply stick the above code into your CSS, and use .clearfix on any box that has to contain a sizable float. Ain't that cool? Just watch out for previous external floats triggering the IE Float Model, as mentioned earlier.
Kudos to Alex Robinson for finding that inline-block is superior to the older inline-table fix for IE/Mac.

A Word Of Warning (this is important!)

The W3C float specification requires that a cleared element shall stay below all previous floats. There are no exceptions to this requirement! "Previous" in this case means any float that comes earlier in the source document.
Up until November of 2004, Firefox was still incorrectly clearing only the floats that were vertically above the clearing element, rather than all previous floats. This meant that in those earlier Gecko browsers you could place a floated column down one side of the screen, and inside another column (possibly another floated column) you could clear a smaller interior float, without that cleared element dropping below the previous floated column. Since only Gecko had this problem, it was obvious that something was wrong every time this happened to a page. Normally Gecko is the good browser, but in this one case it was the culprit. See, IE is not always the bad guy!
However, this easy clearing method has muddled the issue quite a bit, since now Explorer is not actually being cleared at all, while Gecko browsers have finally been corrected so they do clear all previous floats.
...Oh no! Do you see what will now happen in our hypothetical float page? IE, seeing no real clearing elements, will look great. Meanwhile, in newer Gecko browsers and Opera 7, the CSS generated clearing element in the first easycleared box will drag the height of that box waaaay down the page, until that invisible clearer is vertically below the bottom of the previous float column (assuming there is a bottom!). This can "generate" a huge empty space inside that once-small easycleared box, depending on the actual height of the neighboring float column.
Of course Opera 7 has always correctly implimented the clearing specs just like IE does (aside from bugs), and the Mac browsers are not involved either. If you are wondering how this issue can be fixed, well, it can't. Gecko and Opera are now both following the float clearing specs correctly, and IE only fails because of the faked "clearing" we are forcing upon it.

Preventing External Clearing

If you have the above described problem, one way to prevent the clearer from clearing the adjacent float column is to make the container a float itself. Of course once you float the container you no longer need easyclearing, sigh...
Note that when all the main elements in a column setup are floats, the worst IE float bugs simply do not happen. Thus using an all-float approach to column design can actually be easier to accomplish, at least within a rigid-width layout.

Them That Done It

Thanks to Tony Aslett for showing us the way. His site, csscreator.com is a killer CSS forum where newbies and gurus alike hang out and exchange CSS know-how. Tony's original demo page for this method can be found here, and the relevant forum thread is here.
Kudos also to Doug for pointing out the "period problem" in FireFox, and to Mark Hadley for that elegant IE/Mac fix, and to Matt Keogh for showing how "inline-table" also fixes IE/Mac while using an already-approved CSS property. Once more the CSS community comes thru for us all! :-)

Big John Design Contact Us ©positioniseverything.net Last updated: July 2, 2008 Created May 14, 2004

Label:

Post a Comment

Write You comment here! Please...

[blogger]

Contact Form

Name

Email *

Message *

BABALSHOT @2023. Powered by Blogger.