课程: CSS for Programmers

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

The cascade

The cascade

- [Speaker 1] CSS is an acronym for Cascading Style Sheets. In the previous movie, I explained what a style sheet is, so now we can talk about the cascade. As I've mentioned several times already, The browser reads CSS from the top down. In other words, if there are multiple rule sets targeting the same element. The last one in the style order, the one lowest down in the style sheet is applied. Let me show you an example of this. In the preview here, you can see we have this section, which is green. Over in index.html, that section sits down here. It's this div, with a class, highlight. Going into the style sheet, I'm scrolling down, We find a style that targets the class highlight, but the color that's applied is a blue color. So why is it green over here? The reason is, if we keep scrolling down the style sheet, there's another rule with the same selector, highlight, and this time the color is green.…

内容