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 Treehouse Club: CSS My First Web Page Comments, Selectors, and Syntax

Oscar Lopez
Oscar Lopez
971 Points

In Joy's CSS coding page, "style.css," why does she have "max-width: 900px;" twice in the body section?

i have tried it with only one of them and compared it to both of them together and I do not notice a difference.

Harry James
Harry James
14,780 Points

Hey there Oscar!

Where in the video does it say this? I'll have a look for you :)

2 Answers

Harry James
Harry James
14,780 Points

Hey again Oscar,

It must be a mistake in one of the workshop creation for one of the videos in that case, as the workspace for the current video does not have this issue.

Anyhow, like you've stated - by rewriting something twice within the same selector, it will make no difference as due to CSS's cascading nature, it will always pick the last value for the repeated property, and if this is the same as the first value, it will make no difference.

To explain,

samevalue.css
body {
  background-color: red;
  background-color: red;
  /* We'll ignore the first time we set this property, and only use the second. */
}
differentvalue.css
body {
  background-color: red;
  background-color: yellow;
  /* The background color will be yellow as due to the cascading nature, 
the last value for the repeated property is the value that will be used. */

Hopefully this should improve your understanding for this, but if there's anything you don't quite get, give me a shout :)

Oscar Lopez
Oscar Lopez
971 Points

I understand, thank you!

Oscar Lopez
Oscar Lopez
971 Points

It doesnt have it in the video. Thats odd, it did have it in the workspace. Im assuming its only suppose to be one