1

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?

4

3 回答 3

2

是的,你可以这样做:

.noblock, .noblock * {
    display: inline;
}

或者,如果您只想定位直系后代:

.noblock, .noblock > * {
    display: inline;
}
于 2013-05-05T14:15:58.943 回答
0

你可以做:

label.noblock, label.noblock * { display: inline }

*此处用于选择具有类的任何元素内的所有后代labelnoblock

于 2013-05-05T14:16:40.983 回答
0
.noblock, .noblock * {
    display: inline;
}

请注意,最好*用其他东西替换(input例如,如果每个孩子都是这种元素)

于 2013-05-05T14:17:01.877 回答