css - 嵌套的 OL LI 较低的 alpha 不起作用

标签 css

所以我们有一个重置的 CSS 文件,它显然从我们的样式中剥离了阳光下的一切。

因此对于任何 OL LI,我必须在我们的 CSS 文件中明确声明:

#stupidDivTag ol li { list-style-type: decimal; }

所以当我有这个时:

<ol>
  <li>One
    <ol type="a">
      <li>One Alpha</li>
    </ol>
  </li>
</ol>

但由于明确的声明,它似乎不起作用。

我不想使用内联样式,因为我们有成千上万的样式。

而且我不能使用其他明确的声明,例如:

#stupidDivTag ol li ol li { list-style-type: lower-alpha; }

因为其他嵌套列表不应该使用这种样式。

我在这里错过了什么?

是否需要为嵌套的 OL LI 创建一个类?

<ol class="nestedLowerAlpha">

最佳答案

使用直接子选择器:>

#stupidDivTag ol li /* all lis in stupid div tag are decimal */
{
    list-style-type: decimal; 
} 

#stupidDivTag > ol > li > ol > li  /* only second level li will be changed to lower alpha - assuming the first ol is a direct child of stupid div tag */
{ 
    list-style-type: lower-alpha; 
}

关于css - 嵌套的 OL LI 较低的 alpha 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31439955/

相关文章:

html - 关于 bg-image 的所有语法在 css 中都是正确的,但没有显示

css - 在 Contact Form 7 中设计一个 reCaptcha 框

html - 平板电脑和手机的缩放图像

html - 如何通过 CSS 显示多行长链接?

javascript - 如何在knockout.JS中用colorpicker设置 'style:color'

css - 顶部菜单位于侧面菜单的顶部,CSS 错误

jquery - 设置子元素高度以填充 CSS

java - 如何通过现有元素(不是 xpath)查找子(​​不是所有后代)元素

html - 水平和垂直居中两个 div (CSS)

html - 我的 Page.ss 不会加载 css 和脚本 SilverStripe v4.2.1