Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

How do you get a 2nd last child in CSS?

p:nth-last-child(2) {
  text-align: center;
}

// selector for second to the last child
// this will select second p element of parent, counting from the last child.
// parameter passed will determine number of element from the last element.
// in this case 2 which is the second to the last child.
 
PREVIOUS NEXT
Tagged: #How #child
ADD COMMENT
Topic
Name
8+5 =