Selectors in CSS target different parts of HTML. In this video, learn how to write CSS selectors that target HTML elements, classes, and IDs.
- [Instructor] You're already familiar … with a few kinds of selectors as you join this course. … You've encountered elements, classes, and IDs before. … Let's quickly review each type of selector and its use. … The element selector means that … our selector is some type of HTML element. … Paragraphs, articles, sections, … footers, headers, headings, lists, … links, and so much more. … We simply type in the name of the element … and that is the selector for it. … Element selectors are the least specific … in the CSS cascade. … That makes elements a great choice … for writing generic code that should govern … the style for most of your webpage, … using other selectors to override these default values. … A class is a style that can be used … in many different cases on the same webpage. … It's more specific than an element, … meaning that it can override an … element styling easily. … Classes always start with a period in your style sheet … and they are called via the attribute … of class in your HTML. …
Author
Released
5/2/2019- Targeting classes and IDs
- Working with group selectors
- Targeting element attributes
- Targeting links with pseudo-class selectors
- Targeting child elements and empty elements
- Targeting parent, child, and sibling elements
- Best practices for CSS
- The impact of CSS selectors on performance
Skill Level Intermediate
Duration
Views
Related Courses
-
HTML & CSS: Creating Forms
with Clarissa Peterson2h 30m Beginner -
Introduction to CSS
with Carrie Dils1h 58m Beginner
-
Introduction
-
The power of selectors1m 8s
-
-
1. Review of Basic CSS
-
CSS terminology2m 58s
-
Groups of selectors1m 52s
-
Compound selectors3m 19s
-
-
2. Combinator Selectors
-
Descendant selectors3m 36s
-
Parent-child selectors3m 51s
-
3. Attribute Selectors
-
Simple attribute selectors2m 47s
-
-
4. Pseudo-Classes, Pseudo-Elements, and the Universal Selector
-
Understanding :not2m 53s
-
:root and :empty4m 27s
-
5. Choosing Selectors
-
Conclusion
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Simple selectors: Elements, classes, and IDs