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;
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

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?
Open Code Manager We are hiring