【问题标题】:Class being over written by other class类被其他类覆盖
【发布时间】:2011-06-09 18:32:21
【问题描述】:

这是一个简单的 CSS 问题。我的网站存在以下问题:

#main-content ol {
list-style-type: decimal;
padding-left: 25px;}                                  /* abc.css (line 140) */

#contentWrapper p, #contentWrapper ul, #contentWrapper ol, #lmBlurbsArchive {
color: #666666;
font-size: 1.1em;
margin-bottom: 12px;
margin-left: 0;
margin-right: 0;
margin-top: 0;}                                       /* abc.css (line 69) */

/* Code below being striped out/ over written by other class above */
ol.upper-roman {
list-style-type: upper-roman;

【问题讨论】:

    标签: html css css-selectors


    【解决方案1】:

    #main-content ol.upper-roman 应该足够具体以“获胜”。

    因此,在您的 CSS 中,将 ol.upper-roman 更改为上述选择器。

    读一读:

    【讨论】:

      【解决方案2】:

      使用 ID 的选择器比仅使用类的选择器具有更高的值,因此 #main-content ol 优先于 ol.upper-roman

      您必须使用 #main-content ol.upper-roman 覆盖第 140 行的设置。

      【讨论】:

        猜你喜欢
        • 2015-05-14
        • 1970-01-01
        • 2013-10-12
        • 1970-01-01
        • 1970-01-01
        • 2022-01-26
        • 1970-01-01
        • 1970-01-01
        • 2020-04-20
        相关资源
        最近更新 更多