K
K
kpa6uu2015-10-18 15:12:48
css
kpa6uu, 2015-10-18 15:12:48

What is the difference between body table li and body > table > li?

Hello. I'm learning CSS, I have a question about the differences in how these lines work.
For example, what is the difference

body table li{
    background-color: green;
}

from
body > table > li{
    background-color: green;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Golubev, 2015-10-18
@kpa6uu

> is a selector that will only work on nested elements in a strict order.
body > table > li will not work for example on:
body table li ul li
body table li will work on
body table li
ul li

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question