New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

CSS Fundamentals
Illustration by

What is a CSS Reset?


From:

CSS Fundamentals

with James Williamson

Video: What is a CSS Reset?

One of the terms that you'll probably come across from time to time as you become more familiar with CSS is the term CSS reset. A CSS reset is simply the term used to describe a collection of styles that designers use to deal with the browser's default style sheets. As we discussed a little earlier, all browsers have a default style sheet that will be applied to the page if they're not overwritten by the author's styles. Using a CSS reset, a designer can essentially nullify those styles and start from scratch without having to worry about what effect the browser's default styles might have on their own designs.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
CSS Fundamentals
3h 14m Beginner Sep 26, 2011 Updated Dec 13, 2011

Viewers: in countries Watching now:

This course contains a high-level overview of Cascading Style Sheets, while exploring the basic concepts, terminology, and tools of the language. Beginning with an exploration of CSS syntax, author James Williamson explains how CSS modifies text, borders, backgrounds, and color; demonstrates CSS and HTML integration; and contextualizes the current state of CSS. The course also tours some of the most popular CSS editors and frameworks and lists online tools and resources for further study. This course is for people who want a big-picture overview before taking hands-on courses.

Topics include:
  • Understanding basic selector types
  • Integrating CSS with HTML
  • Examining browser rendering differences
  • Exploring CSS specifications
  • Checking browser support
  • Understanding the box model
  • Adjusting margins and padding
  • Positioning elements
  • Exploring basic layout concepts
  • Understanding media queries
  • Introducing CSS3
  • Using CSS Reset
Subjects:
Web Web Foundations
Software:
CSS
Author:
James Williamson

What is a CSS Reset?

One of the terms that you'll probably come across from time to time as you become more familiar with CSS is the term CSS reset. A CSS reset is simply the term used to describe a collection of styles that designers use to deal with the browser's default style sheets. As we discussed a little earlier, all browsers have a default style sheet that will be applied to the page if they're not overwritten by the author's styles. Using a CSS reset, a designer can essentially nullify those styles and start from scratch without having to worry about what effect the browser's default styles might have on their own designs.

For the most part, there are couple of basic properties that most CSS resets establish a baseline for. Those are margins, padding, borders, font-size, and line-height. Now I said "for the most part" because there are many different variations of CSS resets out there and some of them are considerably more complex than others. To use a reset, you simply add your baseline styles to the top of your main style sheet. It's important that these styles are the first styles your browsers encounter, as you want to reset the values site wide and then go back over them and overwrite them with the site's specific styles.

If the reset styles are added below the site's custom styles, all your hard work is undone, and the reset values become the site's styling. As a way of introducing you to CSS resets, I want to show you Eric Meyer's popular Reset CSS file, and I am going to do that by going to his site meyerweb.com, and just you can do an article search, if you wanted to, for "Reset Revisited," and you'll find the latest version of it. Now Eric was one of the first developers to work on CSS resets and many designers, developers, and systems have adopted his approach over the years, and even used his file.

Now rather than go through this code line by line and bore you to tears, I'd rather just discuss what each section is doing as a way of building a bigger picture about what exactly a CSS reset does. So I am just going to scroll down a little bit here, so I get a little bit more into the code. So this first really, really big block a code here takes most of the common HTML elements and resets their padding, margin, and border to 0, essentially eliminating any of those browser default values. It's also going to set the font-size to 100%, and it ensures cross browser stability with font settings in baseline alignments.

From there it goes on to ensure block-level display for newer HTML file elements, it gives a consistent value for line-height and then goes ahead, and removes the styling from list. Now as you can see below this, there is actually a little bit more than just that going on here, but by now I think you get the idea. Now the flip side of this of course is that if you remove the default styling of an element, you have to remember to put your own styling back. If you eliminate the default margins on paragraphs, for example, you have to remember to give them a value later on in your styles, or all your paragraphs wouldn't have any spacing between them at all.

Now, that's one of the reasons that some designers are critical of using a CSS resets. If you plan on setting your own margins for paragraphs in your styles, you're essentially doing the work twice by resetting the value to 0 and then setting it again to the desired value. CSS resets can also cause the browser to do a lot of work. Depending upon the complexity of the reset, you could be asking the browser to go through and style every single element before even beginning to apply the site's actual styling, and this can add a lot of overhead to your sites, for a minimal amount of value on occasion.

Now other designers love the fact that a CSS reset gives them a consistent baseline to build sites from. Instead of having to remember which items they need to overwrite for a site and which they don't, going ahead and using a reset consistently when designing sites means that you know exactly where you're starting from every single time. There's a lot of value in that. Should you use a reset or not? Honestly, there is simply a personal preference that depends on how you as a designer like to work. In fact, the need for a CSS reset can even vary from one project to the next.

Eric Meyer even says in the introduction to his reset that it's not designed to be used as is, that it should be altered and customized to meet the needs of the designer or the project. Unfortunately, I'll be honest with you here, designers have gotten into the habit of just copying and pasting CSS resets into their styles. Now, this approach may give them the default baseline to work from, but in my opinion, it actually creates a more work for them in the long run. By exploring the styling needs of a site carefully and then planning for how a reset can benefit that site, a designer can take a standard reset and tweak it so that the reset is efficiently setting default styling for that project.

My own personal approach to using resets is actually a really minimal one. I simply prefer the zero out default values for elements that I know I'm going to use in the site, and I don't have a set reset that I use for every single project. I have simply just like guiding principle to use smaller efficient resets, if I need them at all. Now if you want to learn more about CSS resets, I recommend checking out cssreset.com. This is an awesome resource that explains a little bit about what a CSS reset is and how to determine if you need one, and it provides you with the links to some of the more popular CSS resets in use today.

You noticed Eric Meyer's resets there, there's the YUI CSS, and a lot more of them. Now if you read the documentation for these resets and go ahead and explore the code that's provided, you will gain a greater appreciation for dealing with browser default styles, when it's appropriate to use these resets, and where the use of a CSS reset fits into your own design philosophy.

Find answers to the most frequently asked questions about CSS Fundamentals.


Expand all | Collapse all
please wait ...
Q: This course was updated on 12/13/2011. Can you tell me what has changed?
A: One movie called "Who is this course for?" was added to provide information on what you can expect to get from the course, depending on your level of familiarity with CSS.
 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed CSS Fundamentals.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.