Descendant selectors vs. element selectors
雨落破晓
雨落破晓 2019-11-15 10:59:05
0
1
1579

Directly using the element selector to define em has the same function as the descendant selector

雨落破晓
雨落破晓

reply all(1)
MrThinco

Yes. However, sometimes, we will choose to use the descendant selector instead of the element selector. For example, let me write a piece of code for you. In the following code, I want to modify the font color of the first em:

<div><em>我是程序界的彭于晏</em></div>
<span><em>我是程序界的周杰伦</em></span>

If the element selector is used directly here, the color of the two sentences in em will be changed, but I only want to change the words in the first em, then at this time, the descendant selector will show its effect.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template