如何在CSS中使用空格引用长类名? [英] How to reference a long class name with spaces in CSS?

查看:49
本文介绍了如何在CSS中使用空格引用长类名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to style some Drupal output. In particular, I'm trying to reference a class with a super long name (that includes spaces). I'm unclear the syntax for this. Forgive me, I'm a CSS newbie. See:

<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属性.我当时想是这样的:

I ultimately want to reference the H2 property. I was thinking it would be something like:

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

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

I cannot just reference the node, since it is used elsewhere for other purposes. I want to be specific and select only this class:

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

推荐答案

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

Using dots (.) you can combine multiple class as a group

.node.node-article.node-teaser.contextual-links-region.node-even.published.with-comments.node-teaser.clearfix {
 ...
}

这篇关于如何在CSS中使用空格引用长类名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆