Tutorial: Clearing floats in CSS tip

This is an extremely easy tip to clear floats in CSS, making use of a html element with barely no use (if you use it, you can choose another one you don’t use at all). In this case, I’ll use HR. I guess the last time I’ve used the HR tag must have been in 1997 or so. Hey, that’s from another century, even another millenium!

Anyway, on to this easy time saver

1) in your CSS sheet define the HR. It’s a wise move to do it within your element reset list (if you don’t know what this is, you really should learn CSS first). We’ll do it as follows:

hr{clear:both; margin:10px 0;}

done. Did you expect more than that? Now you can use the hr tag any time you need to clear floats in CSS.

by the way, do you see that margin thing? well, you really don’t need it. But I use it to add some vertical space as well. So, instead of opening and closing divs, I just use the hr tags and clear floats and get the space by adding just…. 4 characters!


Leave a Reply

design portfolio
view more
blog, latest rants, blabbling, marketing

We use the latest technology and design trends to create successful sites with a strong marketing development that helps us give you a product that not only looks good, but it converts better than any other design choice (data based on 3rd party stats). Our speciality were always paysites, but now we develop high end solutions, CMS, TMS, blogs, etc. Using AJAX/AHAH, JQuery, Flash and other media tools, we can provide your site with THAT SPECIAL TOUCH!

Click the button below to know more about what we do or check out our adult website design portfolio!

view more

Categories

Recent entries

Keywords

Archives

Copyright 2008 - FDSign – Adult Design - All Rights Reserved - Design by FDSign