![]() |
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;} 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 :) |
nifty trick :) and yeah i agree on the 1998 thing about HR's
I do the same thing with a clear class like Code:
.clear {clear:both;} Code:
<div class="clear" style="height:xxpx;"></div> |
I use the JD method, but I like the hr idea too.
|
Quote:
|
Quote:
1) for predictable cross-browser results call every variable at the beginning of the style sheet. ie: font-family font-size font-style line-height margin padding p margin p padding div margin div padding i margin i padding em margin em padding etc etc etc Just obey cascading for the best results. I keep all base (global) styling in a 'base' file to be read 1st. Then unique page/site styling in a unique CSS file to be read 2nd. ... :2 cents: |
guess what this does?
#index_table IMG:hover { BORDER-RIGHT: #f09 2px ridge; border-top: #f09 2px ridge; border-bottom: #f09 2px ridge; border-left: #f09 2px ridge; FLOAT: left; MARGIN: 0px 5px 0px 0px; |
Quote:
|
|
Quote:
StuartD invented CSS :pimp |
I like the simplicity of your HR trick! I should start using it :thumbsup
|
Thanks for sharing your tips. I am just learning how to do all the css stuff.
|
Quote:
Quote:
Quote:
Quote:
|
Quote:
Keep up the good shit :thumbsup |
Code:
.clearFix:after { |
Code:
* {margin:0;padding:0;} |
|
Quote:
|
All times are GMT -7. The time now is 05:47 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123