TEL:400-8793-956
当前位置:程序、服务器

CSS这个选择器是什么意思?

提问者: 近期获赞: 浏览人数: 发布时间:2020-12-14 13:06:52

问:.myForm2 label>span

{
 
}
。我了解myform2标签。它是class = myform2下的标签,
这> span是什么意思?
 
答:就像光旁吧说的那样。
 
Label span is the selection of children and grandchildren, which will affect all the items in the label.
label span {
    color: red;
}
<label >
    <span> //red
        <span> //red
            <span></span> //red
        </span>
    </span>
</label>
Label > span is a selector, which only affects the child * *! Important * *.
 
label > span {
    color: red;
}
<label >
    <span> //red
        <span>
            <span></span> 
        </span>
    </span>
</label>
 
Span, because there is another case of label
 
<label >
    <i>
        <span>
            <span></span> 
        </span>
    </i>
</label>
此方法的目的是防止某些样式的继承,这可能会影响许多元素。
 
答:Label span is to select all span labels under label
Label > span is to select the label whose sub element is span
上一篇: PHP协程代码执行顺序
下一篇: 如何打开微信授权获取应用中嵌入式网页的openid?