nth-last-of-type Selector

nth-last-of-type Selector
CSS nth-last-of-type Selector reference
The CSS nth-last-of-type structural pseudo-class selector ( X:nth-last-of-type() { } ) is used to target and style specified child elements according to their position in their specified parent element. This selector is similar to the X:nth-of-type() selector, except that it starts counting from the last element instead of counting from the first element.
CSS CODE EXAMPLE
<!DOCTYPE html>
<style type="text/css">
div p:nth-last-of-type(3) {
    color:#F0F;
    font-weight:bold;
}
</style>
<div>
  <h3>Heading content</h3>
  <p>Paragraph content...</p>
  <p>Paragraph content...</p>
  <p>Paragraph content...</p>
</div>
<hr />
<div>
  <h3>Heading content</h3>
  <p>Paragraph content...</p>
  <p>Paragraph content...</p>
  <p>Paragraph content...</p>
</div>
 

Heading content

Paragraph content...
Paragraph content...
Paragraph content...

Heading content

Paragraph content...
Paragraph content...
Paragraph content...

0 Response to "nth-last-of-type Selector"

Post a Comment