bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/CSS/CSS Foundations
CSS•CSS Foundations

Multiple Style Sheets & Cascading Order

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Multiple Style Sheets & Cascading Order?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___: navy;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Assume that an external style sheet has the following style for the <h1> element:
If some properties have been defined for the same selector (element) in different style sheets, the value from the last read style sheet will be used.
Multiple Style Sheets

Multiple Style Sheets

If some properties have been defined for the same selector (element) in different style sheets, the value from the last read style sheet will be used.

Assume that an external style sheet has the following style for the <h1> element:

h1 {
 color: navy;
}

Then, assume that an internal style sheet also has the following style for the <h1> element:

h1 {
 color: orange;
}

Example

Formatted code
<head> <link rel="stylesheet" type="text/css" href="mystyle.css"> <style> h1 {
  color: orange;
}
</style> </head>

Live preview

Example

Formatted code
<head> <style> h1 {
  color: orange;
}
</style> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head>

Live preview

Cascading Order

What style will be used when there is more than one style specified for an HTML element?

All the styles in a page will "cascade" into a new "virtual" style sheet by the following rules, where number one has the highest priority:

  • Inline style (inside an HTML element)
  • External and internal style sheets (in the head section)
  • Browser default

So, an inline style has the highest priority, and will override external and internal styles and browser defaults.

Previous

How To Add Inline CSS

Next

CSS Comments