Quick Tips : Clearing Breaks

Wednesday, October 14th, 2009

Yes they’re a dirty little web trick but clearing breaks can come in quite handy in these troublesome cross browser issue ridden days.

To learn more about floats and how they work have a read of this vanseodesign.com article.

So how to use them, well personally I declare 3 styles in my CSS

/*clear breaks*/
br.clearright{ clear:right; line-height:0;}
br.clearleft{ clear:left; line-height:0;}
br.clearboth{ clear:both; line-height:0;}

They obviously correspond to clearing left, right or both. Then when I have a section of code where I need to clear something I call one in.

</div>
<!--clear needed here//-->
<br />

Also take note of the line-height:0, this helps when IE likes to stick in padding and margins and borders and all sorts of other stuff you didn’t ask for!

Nice and simple!

Tags: , , , , ,

Filed under Quick Tips.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Leave a Reply


CommentLuv Enabled

RSS FeedFollow me on twitter - @dsparks83



Advertisments

heart internet WooThemes - WordPress themes for everyone

Tags

analytics, blogging, CSS, CSS3, design, development, ecommerce, Flash, google, guest post, HTML, HTML5, HTML email, IE6, interview, Javascript, random, randomiser interview, Web Design, XHTML