I have the following
<label class="noblock">
<input> ...
...
</label>
I want to specify the CSS display: inline
for the class noblock
as well as all children of it (anything inside it). Is there a way to do that?
是的,你可以这样做:
.noblock, .noblock * {
display: inline;
}
或者,如果您只想定位直系后代:
.noblock, .noblock > * {
display: inline;
}
你可以做:
label.noblock, label.noblock * { display: inline }
*
此处用于选择具有类的任何元素内的所有后代label
noblock
.noblock, .noblock * {
display: inline;
}
请注意,最好*
用其他东西替换(input
例如,如果每个孩子都是这种元素)