Join James Williamson for an in-depth discussion in this video Targeting empty elements, part of CSS: Selectors.
- Although Empty Elements don't happen…all that often, there are times that…an element in your code might not…contain any content.…That's especially true if you're using…any type of service that auto-generates code.…Now, when that happens,…the Empty Pseudo-Class Selector…can actually target and style them.…There are, however, a few rules about…when an element is actually considered empty,…so let's take a look at how it works.…So here I have the empty.htm file…from the 04_03 directory opened up,…and the first thing I want to take a look at…is the Syntax.…
So here, if I scroll down, you can see…that we just have the empty pseudo-class selector…so it has a column that precedes it.…And if we want to make it element specific,…meaning find any table cells that are empty,…we could do that by simply placing…the simple selector, td, in front of it,…with no white space.…So, fairly easy selector to write.…Now, I'm gonna open up this same file…in my code editor,…and I want to scroll down to the example area…because I want to show you what's meant…
- Targeting classes and IDs
- Working with group selectors
- Targeting element attributes
- String matching
- Targeting links with pseudo-class selectors
- Targeting child elements and empty elements
- Targeting parent, child, and sibling elements
- Matching patterns
- Writing efficient selectors
Skill Level Intermediate
CSS: Advanced Typographic Techniqueswith James Williamson3h 14m Intermediate
HTML5: Graphics and Animation with Canvaswith Joe Marini3h 7m Intermediate
1. Basic Selectors
2. Attribute Selectors
3. User Action Pseudo-Class Selectors
4. Structural Selectors
6. Matching Patterns
7. Writing Efficient Selectors
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.