CSS3 Selectors: last-of-type

This entry is part 33 of 40 in the series CSS3 Selectors

As with :first-of-type, you can achieve the same effects using :last-of-type.

Here, we target the last paragraph of a section.

Codecrawl.com – HTML5

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com - HTML5</title>
        section p:last-of-type {
            color: blue;

        <h1>Rod Stewart</h1>

        <p>Rod Stewart is one of the best-selling music artists of all time</p>

        <p>Having sold over
            100 million records worldwide.</p>


Series Navigation<< CSS3 Selectors: first-of-type
CSS3 Selectors: nth-of-type >>

Leave a comment

Leave a Reply