css-diner icon indicating copy to clipboard operation
css-diner copied to clipboard

Task 17

Open Masimakinova opened this issue 2 years ago • 3 comments

Hi! I resolved task number 17 but I don't understand how it worked. Why it didn't picke small orange ? I wrote this: " .small:last child "

Masimakinova avatar Dec 26 '22 16:12 Masimakinova

Hi, If you want to select every -last-child remove the ".small" from your request so : :last-child ==> selects small apple in fancy plate, large last orange in the plate and small last pickle.

MarcusOrhan avatar Dec 27 '22 05:12 MarcusOrhan

@Masimakinova - I thought the same and wondering why is it acceptable.

Sanjincs avatar Jul 31 '23 07:07 Sanjincs

@Masimakinova @Sanjincs Hello, I got stuck reasoning about this answer too, but trying other selectors helped me understand why this works the way it does.

The .small:last-child selector doesn't pick the small orange because the small orange is not the last-child of the parent plate tag. The large orange is the last-child.

You can see this if you choose plate orange:last-child as your selector: the large orange vibrates, not the small orange.

You can also see this if you enter .small:first-child so both the small orange and the small apple are selected, but the small pickle is not selected because while it has class=small, it is the last element of the table, not the first.

ricardoanguiano avatar Dec 04 '23 00:12 ricardoanguiano