嵌套OL LI低alpha不起作用

时间:2015-07-15 20:03:05

标签: 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">

1 个答案:

答案 0 :(得分:0)

使用直接子选择器:>

#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; 
}
相关问题