Using a CSS Reset File

Article Image - Using a CSS Reset File Article Image - Using a CSS Reset File

For those of you still struggling with designing a standards based accessible website, one of the biggest challenges in this approach is getting layout and typography to look the same in cross browers.

The reason why there are so many inconsistencies with different browsers is that they all render different elements of a page slightly differently. This doesn't mean that they are always going against standards, as there are no rules for defining what size padding, and margins should be used for headings, tables etc… For example you may notice that H1 tags with no styling can look drastically different, this is because each browser sets their own font size, weight and line-height to this element.

The Solution
This is where the CSS reset files comes into play. This is basically another CSS file that you include in your page, and its aim is basically to strip away every default styling for each element. All padding, line-height, padding and margins will be stripped unless that is their semantic meaning, i.e. the strong tags font-weight will be left alone.

Will I then have to restyle everything? Yes, but it's not as bad as it seems. With the reset file you are now able to style everything the way that you want, you can assured most of the time that it should look the same in other browsers. This doesn't go to say that your layout will always work perfectly, especially in IE6. But from my experience, applying a reset file has shortened the amount of time drastically that I spend on cross browser testing.

Below is the CSS reset file that I use on this site, it has gone through many revisions to get it where it is today, and I'm sure that I will still be tweaking it for a while to come.

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
/* remember to define focus styles */
:focus {
outline: 0;
}
/* remember to highlight inserts */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

Top Hosts

    • Unlimited bandwidth
    • Unlimited disk space

    iPage hosting offers fast web hosting on a high performance server.

    $2.95
    • Unlimited bandwidth
    • Unlimited disk space

    50% Off, regular price $7.33! Excellent support! Anytime money back gaurantee, and domain for life!

    $3.67
    • Unlimited bandwidth
    • Unlimited disk space

    Free domain for life! Instant Setup. $25 Free Yahoo Credits. Outstanding Support! No hidden fees!

    $4.45
    • Unlimited bandwidth
    • Unlimited disk space

    Will spare nothing to please customers. 100$ Free Marketing Credits.

    $4.95
    • Unlimited bandwidth
    • Unlimited disk space

    Unlimited websites on one account. Free 1 click installs for over 50 scripts! Excellent support and value!

    $4.95

Hi I'm Craig, welcome to BestHostingTop10.com. Looking for a new web hosting company can be a daunting task... read more

  • Hi Craig, Your free service is great. I did my homework on webhosting providers first, and must say your Ranking Table is Spot on! Thanks - Terrence AZ
  • Craig, you have been fantastic with your vast knowledge of webhosting - Zak UT
  • Thanks Craig, you made our web hosting choice so easy. - Phillip FL
  • You Guys at Bestwebhostingtop10 rock! We moved our Webhosting on your advice and best thing we ever did! - George CA
  • Click here to add your own testimonial