Using simple selectors in CSS is just the beginning. In this video, learn how to target HTML elements based on the HTML structure and select multiple elements at the same time.
- [Instructor] Let's look at a few more ways…to select elements.…When an element is nested inside of another element,…it becomes its child or descendant.…In CSS, you can select these elements based on this…relationship by using descendant selectors.…Use multiple selectors separated by a space…to match descendant elements.…For example, to select the link contained…within a paragraph, the selector is P space A.…Browsers read these selectors from right to left,…so we'll first look for the A tag, which is the hyperlink…element, then an A tag inside of a P tag.…
Descendant selectors can be used for any nested element.…Not just parent child elements.…Let's take a look at this example in another JSFiddle.…Let's follow the instructions in the HTML…comments on the left.…The first one says to select all h2 elements on the page.…So for this, I can use a type selector of h2.…Open my curly braces,…and I'll just add a color value.…
And run the code.…So I've selected all h2s.…Number two says to select the h2…only within the section element…
- 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.