如何在CSS中引用带有空格的长类名?

2024-02-10

我正在尝试设计一些 Drupal 输出的样式。特别是,我试图引用一个具有超长名称(包括空格)的类。我不清楚这个的语法。请原谅我,我是 CSS 新手。看:

<article id="node-38" class="node node-article node-teaser contextual-links-region node-even published with-comments node-teaser clearfix" about="/~actionin/node/38" typeof="sioc:Item foaf:Document">
    <header>
        <h2 property="dc:title" datatype=""><a href="/~actionin/node/38">National Nutrition Month: March 2012: “Get Your Plate in Shape”</a></h2> 

我最终想引用 H2 属性。我想这会是这样的:

.node SOMETHING-HERE .header h2 { declaration; }

我不能只引用该节点,因为它在其他地方用于其他目的。我想具体一点,只选择这个类:

class="node node-article node-teaser contextual-links-region node-even published with-comments node-teaser clearfix"

使用点 (.) 您可以将多个类组合为一个组

.node.node-article.node-teaser.contextual-links-region.node-even.published.with-comments.node-teaser.clearfix {
 ...
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在CSS中引用带有空格的长类名? 的相关文章

随机推荐