CSS Reset

CSS Reset

1 Star2 Stars3 Stars4 Stars5 Stars
Posted on February 16, 2009

It’s a good idea at the start of writing your CSS code to reset the CSS across all browsers to ensure that your page renders more or less the same. By default different web browsers use different values for margins, padding, or line heights. A CSS reset script will ensure that most browsers will render your site identically, without the need to individually bug fix incorrect CSS properties.


# html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, blockquote,
# pre, form, fieldset, table, th, td { margin: 0; padding: 0; }

Separate your style sheets

IE6 is like a bad word in the web design world simply because the browser is outdated and not up with todays web standards, however it’s here to stay for a while yet due to many corporate companies refusing to upgrade to IE7. Its a good idea to separate your style sheets and put your IE6 and 7 CSS work arounds in different style sheets, you can then use a simple ‘if’ statement to target the relevant browser like below.

<!--[if IE 7]><link rel="stylesheet" type="text/css" href="IE7styles.css" /><![endif]-->
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="IE6styles.css" /><![endif]-->

Recent shares

More tutorials from Papermashup
Comments
2 discussions around CSS Reset
  1. Jesper Rimmer says:

    Is there any difference between your CSS-reset above and just typing the following:

    * {margin:0; padding; 0}

    Thanks..

    • Ashley says:

      Hi Jesper,

      It’s not good practice to use the *{margin:0; padding:0} method. as it’s very heavy on the browser rendering agent to apply rules to every single element in the document, especially with large web pages, and this can also destroy a lot of good default styling, especially when you want to have default style submit buttons, text areas and inputs etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Looking for a registry cleaner to speed up your PC and show a full diagnostics?
Faster surfing with Dish Network High Speed Internet

Never miss an update from Papermashup

Get notified about the latest tutorials and downloads.

Subscribe by Email

Get alerts directly into your inbox after each post and stay updated.
Subscribe
OR

Subscribe by RSS

Add our RSS to your feedreader to get regular updates from us.
Subscribe

Get in contact

Please use the form below to get in touch.

About Me

I'm Ashley Ford, Co-founder and Technical Director at Harkable.com London, UK. Previously I worked at InMobi, Spotify and MySpace. My interests include photography and making short videos I'm also an avid F1 fan. I'm always working on side projects. Here are a few: Easy Poll, We Deliver.



What do you specialise in?

I spend a lot of time coding in PHP and MySQL, as well as front end XHTML and CSS. I also specialise in javascript and the jQuery framework as well as being an avid designer. You can find me on dribbble

Interested in advertising?

If you'd like to advertise on Papermashup.com you can find details here Or use the contact link below for further advertising opportunities.

How do I contact you

You can contact me here. and I'm available for consultation, freelance, programming book reviews.

Get on the mailing list

Join over 3000 people who have subscribed to the Papermashup inbox message, and be the first to find out about tutorial, competitions and giveaways.