CSS3 > Selectors

Last-of-type selector in CSS3

How to match the every last child of its parent element in CSS3?

By using last-of-typeselector we can match the every last child of its parent element.

        p:last-of-type {
            color: blue;
            background-color: orange;
            font-family: 20px;

    <strong>This is Strong Statement</strong>
    <p>This is first paragraph.</p>
    <p>This is last paragraph.</p>
    <b>This is Bold.</b>
        <p>This is the first pargarph in div.</p>
        <p>This is the last paragraph in div.</p>

In the above code snippet we have given style to the <p> element, so that the style applies to the last child of every <p> element in all the parent elements.


 Views: 1088 | Post Order: 28

Write for us

Hosting Recommendations