PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a web form that users will use to enter their personal information. The form includes the
following HTML.

You have the following requirements:
When a user enters an input box, the cell on the right must turn green.
When a user leaves an input box, the cell on the right must turn white.
You need to create the web form to meet these requirements.
Which code segment should you use?
nth-child

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
* The :nth-child(n) selector matches every element that is the nth child, regardless of type, of its parent.
n can be a number, a keyword, or a formula.
Example
Specify a background color for every <p> element that is the second child of its parent:
p:nth-child(2) {
background: #ff0000;
}
* parent.next()
Here: the cell to the right of the current cell.
CSS3 :nth-child() Selector


Leave a Reply