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

HTML How to Make a Website CSS: Cascading Style Sheets CSS Facts

what should come after a css property and why

?

4 Answers

Iulia Kraiter
Iulia Kraiter
858 Points

In Css one rule comes after another, like water that keeps going over a cascade, so one rule can cancel out a rule that came before it.

So for example, if I have a rule that says

section { background: #ccc; }

and then a rule that says

section { background: #784455; }

the background of the main part of my page will be the second color that I wrote the section to be.

I hope this helps.

thanx for helping me again

Iulia Kraiter
Iulia Kraiter
858 Points

Hello Atik,

After a CSS property comes a value that tells the what should be done with the element you selected from the HTML code. The selector, the property and the value between curly braces is called a rule. For example, all of the following is a rule

nav { background-color: #553377; }

is a rule that says what the background color of the navigation should be. The selector is the nav, which selects your navigation from the html file, the property is the background-color, and the value is the color you want your navigation background to be. The property and the value go between curly braces.

I hope this helps. :)

thank you lulia kraiter. i need your one more help ?

u can tell me the meaing of cascading in css ?

lulia Kraiter can u guide me in doing my project ?

Iulia Kraiter
Iulia Kraiter
858 Points

Hello Atik,

I have to applogize for not replying to you sooner. I could help you little by little, as long as I am ahead of you in the videos because I am a beginner too. I thought I relpied to the question about what cascading means in css but I am sad to see that the response is not here.

Cascading in Css means that one rule comes after another and one rule can cancel out another.

For example,

if I write

nav { background-color: #5287ff, }

and then I write another rule for the background color of the navigation and I say

nav { background-color: #682134; }

that means that the color of the background color of the navigation will be the second color I wrote down because it comes after the first.

If I write a third color for the background of the navigation, the navigation background will be the third color.

I hope this helps!

Iulia Kraiter
Iulia Kraiter
858 Points

Wait, I did not see my second answer here when I reposted it. That's strange, but yes, I would be glad to help you with anything else you have a question about.

thank you lulia kraiter and my name is afroz

lulia kraiter what is padding?