CSS3 Selectors: Last-child

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

E:last-child:- An E element, last child of its parent.

Its usage is similar to first-child.

In the example below, it selects the third paragraph under the <div> tag.

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>HTML Table</title>
        div#introduction p:last-child {
            color: blue;
            font-family: Arial;
<div id='introduction'>
    <p>Ushuaia is the capital of Tierra del Fuego, Antártida e Islas del Atlántico Sur Province.</p>

    <p>It is commonly regarded as the southernmost city in the world.</p>

    <p>Ushuaia is located in a wide bay on the southern coast of Isla Grande de Tierra del Fuego, bounded on the north
        by the Martial mountain range and on the south by the Beagle Channel.</p>


If you apply last child to a table:



Series Navigation<< CSS3 Selectors: Using first-child to format table header
CSS3 Selectors: Structural pseudo class :nth-child(n) >>

Leave a comment

Leave a Reply