Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Basics (2014) Fundamental Concepts The Cascade: Importance

Gary Byrne
Gary Byrne
16,514 Points

User style sheet vs Author style sheet

Hi there,

I am having difficulty understanding how user style sheets work. I understand that the author style sheet has most importance so why cant user styles be wrote in author style sheets? Surely the will be overwritten anyways? Sorry if this makes no sense, I am just trying to see the point of it.

5 Answers

Liam English
Liam English
3,837 Points

User style sheets

A user is anyone who looks at your website.

Most modern browsers allow users to set their own style sheets within their browser. These style sheets will override the browsers default style sheets - for that user only.

It is important to know that users can set color and background color for HTML documents. If you, as an author, do not specify a color or background color, a user's style sheet could be used. More importantly, you should either specify both color and background color or neither. If you only specify a color and the user has specified the same color for their background, your entire document may be inaccessible to this user.

Author style sheets

The author is the person who develops the website - you!

As soon as you apply a basic style sheet or an inline style to a page, you have added what is referred to as an "author style sheet". Everything you do, from choosing fonts, colors and laying out pages in CSS is done using author style sheets.

Author style sheets can be applied inside an HTML document or by linking to an external file. You can also use multiple style sheets on an particular document to take advantage of the cascade.

Generally speaking, author styles override user styles which override browser styles.

Source

Emmanuel Molina
Emmanuel Molina
9,268 Points

The "user style sheet" is often set by the user in the browser's options. For example you can set a bigger font size if you have a hard time reading small fonts. Remember that "em" and "rem" use the default font size as reference. Often it's 16px but the user can set another size. And all will be adapted accordingly.

i am really having a difficult time to understand the main difference between the user style sheet and the author style sheet

Mark Pryce
Mark Pryce
8,804 Points

A user stylesheet can take presidency over an author stylesheet when the !important declaration is used.

A user stylesheet is used mostly for accessibility purposes such as some users might need a larger font-size or change links so they are easier to spot.

It's very rare a user stylesheet would change a Web page completely.

That's just my idea of it might be wrong :P

Happy coding.

The thing is clear enough. The user is the person viewing the page made by the author(the one who made the website).

The user stylesheet may contain a few preferences (like font sizes, images etc) but the author has the power here bcoz s/he has created the page and set the rules according to his/her liking. that's why the author style sheet is rendered important. Hope that helps Happy coding