Chrome Extension

Change Last element style using CSS

You can change the style of the last HTML element of a group using CSS by using pseudo-class :last-child.
ul li:last-child {
    background: #ff0000;
    border: 1px solid #ff0000;
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

We can use :last-child pseudo-class is used to select the last element of a group of HTML elements. In the above code snippet example, we are changing the CSS style of an <li> element which is the last element of its parent.

Search Index Data (The code snippet can also be found with below search text)

last child CSS
Was this helpful?
Join Devsheet Ask a Question