问:.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