From the course: CSS Shorts

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Every nth element

Every nth element - CSS Tutorial

From the course: CSS Shorts

Every nth element

- [Chris] Hi. I'm Chris Converse. And in this episode, we'll use the nth-child selector in CSS to pick out specific HTML elements within a group. So if you'd like to follow along, download the exercise files and we'll begin by opening the HTML file in a text editor. And so once you have the HTML file open, if you scroll down inside the body element, you'll see a header and an article element. Inside of the article element is a series of divs. Each div has a different day and a title from a different episode from CSS Shorts. And it's these div items that we're going to be counting. And if you take a look at this in a browser, you'll see a layout that looks something like this. So to continue, let's go back to the exercise files, and let's open up style.css in our text editor. And so in the css file, let's scroll down to the bottom. Let's add a rule down here at the bottom that's going to target the seventh item in the list. (typing) So we'll start with article, then a space, then we'll…

Contents