Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
The:last-child selector not working as expected in HTML5
The last-child selector is used to select the last child element of a parent. It cannot be used to select the last child element with a specific class under a given parent element.
Style the last child li element with background-color −
li:last-child{
background-color: blue;
}
It creates issues if the element is not the very last element.
Let us see an example of <a> −
If your selector is a:last-child, this works −
<div> <a></a> <a>This will be selected</a> </div>
Advertisements
