$('div:nth-child(2)').css ('background', 'red')
applied.
div
I tried to apply it to my second child,
I don't know why it applies to all children except section data-role=header
$('div:nth-child(1)').When running css('background', 'red')
The first child of div
It applies well to id=dee2
.
When CSS instructs div:nth-child(2)
, what does the browser do to select?
In the given code, $('div:nth-child(2))
is kept by #dee1
and #dee3
. Why? Because #dee1
is the second element under the parent section[data-role=page]
and #dee3
is the second element under the parent #div1
. Give a little transparency to the background and you'll understand the situation better.
Find out more.
© 2024 OneMinuteCode. All rights reserved.