Writing CSS can be tricky because some style rules take precedence over others. Learn about cascading, inheritance, and specificity in this video.
- [Instructor] In the last exercise,…I put the general styles at the top of the CSS file.…That's because CSS executes from top to bottom…so the order of your declarations can affect…how the browser reads it.…If the selector is the same,…the declaration that comes after…overrides the one that comes before.…You might by thinking,…why would I use the same selector twice?…This is actually quite a common error.…As your CSS files get bigger and longer,…you may forget that you've already declared the selector…and add it again.…
That's why organizing the CSS interrelated blocks,…like in the previous exercise,…can help reduce these types of errors.…The Cascade Rule also applies to CSS declarations…written within the same declaration block.…One of the strengths of CSS is the styles can be inherited…from the ancestor to descendant elements.…This makes it easier to apply a style to several elements…with one line of code,…rather than defining the style for each element.…
However, there are some properties…that won't be inherited by all elements.…
- Creating a CSS file
- Writing basic selectors
- Setting properties
- Using different typefaces and web-safe fonts
- Understanding cascading and inheritance
- Setting a font family, font size, text color, and more
- Understanding the box model
- Using the float property
Skill Level Beginner
1. Getting Started
2. CSS Core
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.