针对新的不同样式定位容器中的多个选择器 [英] targeting multiple selectors in a container for new different styles
本文介绍了针对新的不同样式定位容器中的多个选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我们假设我们有几个元素( p
, h4
, h5
, h6
,标签
。所有元素已在容器外部设置样式
Let's think we have a couple of elements (p
, h4
, h5
, h6
, label
) that are contained in div.container
. All element has been styled outside the container
p, h4, h5, h6, label{color: #fff;}
但是我们想为它们设置新的样式,当它们包含在特殊容器中时,我通常写: p>
but we want to set new style for them when are contained in that special container so i usually write:
div.container p, div.container h4,
div.container h5, div.container h6,
div.container label{color: #ddd;}
一切正常,编码。有没有一种方法(更短的编码)来定位所有这些元素?例如:
everything is OK, just this is too long too coding. is there a way (shorter coding) to targeting all those elements? like:
div.container [p, h4, h5, h6, label] {color: #ddd;}
请注意:我不想使用预处理器。
note: i don't want to use pre-processors.
推荐答案
没有绝对的方法,没有预处理器。
There is no absolute way to do that without pre-processors.
这篇关于针对新的不同样式定位容器中的多个选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文