From the course: CSS: Selectors

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Pseudo-classes for in-page navigation, :target

Pseudo-classes for in-page navigation, :target - CSS Tutorial

From the course: CSS: Selectors

Start my 1-month free trial

Pseudo-classes for in-page navigation, :target

- [Instructor] The next selector I'd like to tell you about is the target selector. And initially I thought the target selector had to do with a target in a link, like target equals blank. But actually the target has to do with navigation bars that are going to navigate you within a given page. So here what I have is a little bit of html where I have a table of contents and maybe I have a really long article of some kind and this is going to be able to skip me down to the various parts of the article. As we scroll down you'll see that I have some headings that are calling for part one and part two. So by styling target over here, we simply just say target and the background color of gold. What this is going to do is nothing that's immediately obvious here in the display of this webpage, but when I do click on my part one here, it will highlight that particular part of the article and the same here for part two. That's kind of nice when you have a page like this where it's kind of…

Contents