View Single Post
Old 11-30-2009, 03:47 PM  
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
OK, here's a little CSS trick

so I really got tired of fixing some CSS sheets with HORRORS (they're not even errors), therefore here's a tip for you guys to save bandwidth, make spacing coherent and clear floats all at once while saving time.

First, for those that still don't know (the vast majority for what I see), you should do something at the top of every stylesheet: reset everything. I won't go further on that since there are gazillions of tutorials on it.

So while you're resetting everything, add this:

Code:
hr{clear:both; visibility:hidden; margin:10px 0;}

/* modify the margin to whatever you want */

Now, every time you need some spacing or clear floats, instead of redefining or adding elements, simply add the <hr/> tag and that's it

of course, in the event that you need a real <hr> simply define it like <hr class="whatever" />, but chances are 99 times out of 100 you won't need the hr tag. Hell, if I remember right the last time I used the hr tag was in 1998!

Anyway, hope you like it
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote