ZaZaKi, a web developer Between Manchester UK & Rotterdam NL. © 2015-2024.

Select last child element, CSS

ul is a parent tag of li and li is a parent tag of a tag, this code will selects last li tag inside ul tag than the a tag will be select inside li tag.

select last child element

  ul li:last-of-type a{color:red;}

in working

<!DOCTYPE html>
<html>
<head>
<style>
     ul li:last-of-type a{color:red;}
</style>
</head>
<body>

<ul>
<li><a href="#"> a linke </a></li>
<li><a href="#"> a linke </a></li>
<li><a href="#"> a linke </a></li>
<li><a href="#"> a linke </a></li>
<li><a href="#"> a linke </a></li>
<li><a href="#"> a linke </a></li>
</ul> 

</body>
</html>
Categroy:
CSS , Front-end , HTML , PHP