nth-last-child Selector
CSS nth-last-child Selector reference
The CSS nth-last-child structural pseudo-class selector ( X:nth-last-child() { } ) is very similar to the X:nth-child() selector except that it counts inward from the last element of type. You can refer to the description for X:nth-child() to learn about a few details that they share. Just remember that this one counts inward(upward) from the last.
CSS CODE EXAMPLE
<!DOCTYPE html>
<style type="text/css">
ul li:nth-last-child(2) {
color:#F0F;
font-weight:bold;
}
</style>
<ul>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ul>
<hr />
<ul>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ul>
<style type="text/css">
ul li:nth-last-child(2) {
color:#F0F;
font-weight:bold;
}
</style>
<ul>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ul>
<hr />
<ul>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ul>
- List item
- List item
- List item
- List item
- List item
- List item
- List item
- List item
- List item
- List item
0 Response to "nth-last-child Selector"
Post a Comment