K
K
Konstantin2019-11-22 11:19:06
css
Konstantin, 2019-11-22 11:19:06

Explain why the first _description is not highlighted?

There is such an example https://jsfiddle.net/uanzk6pb/6/ , but why is the first description not highlighted? at the same time the heading is tinted. Even if you leave only the .landing-block__description:first-child selector, it won't work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roma Zvarich, 2019-11-22
@small_jedi

Not highlighted because the pseudo :first-child-class points to the first element among all elements, not the first element with the given class.
Essentially, a selector .landing-block__description:first-childmeans an element with the class .landing-block__descriptionthat comes first in the markup.
But he's not the first. Before it there is still an element with the class.landing-block__title

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question