last-of-type Selector

last-of-type Selector
CSS last-of-type Selector reference
The CSS last-of-type structural pseudo-class selector ( X:last-of-type ) is used to target and style the last occurence of the specified element inside of a specified parent element. It is exactly the same as using X:nth-last-of-type(1) with a value of "1".
CSS CODE EXAMPLE
<!DOCTYPE html>
<style type="text/css">
ol li {
    background-color:#B7FFBA;
}
ol li:last-of-type {
    background-color:#FFF1C4;
}
</style>
<ol>
  <li>List item</li>
  <li>List item</li>
  <li>List item</li>
</ol>
 
  1. List item
  2. List item
  3. List item

0 Response to "last-of-type Selector"

Post a Comment