From the course: CSS Shorts

Unlock this course with a free trial

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

First things first and last things last

First things first and last things last - CSS Tutorial

From the course: CSS Shorts

First things first and last things last

- [Chris] Hi, this is Chris Converse, and in this episode we're going to make use of the first-of-type and last-of-type properties in CSS. This allows us to select and style specific instances of elements within a parent. And this is a great technique for styling the beginning and ending of a string of items, such as links, which is what we're going to be doing in this episode. Now, what I like most about this selector, is that if enough another element is in the same parent, it will have no effect on this selector, because this selector is based on an element's type. So if you'd like to follow along with me, download the exercise files and let's open index.html file in a text editor. And now with the html file open, down here we're going to be focusing on the anchor links that are inside of a div with a class of more_info. So we're going to be using the CSS selectors to pick out the first item here, and the last item, but we don't want to add any additional html into here. I don't…

Contents