1

我没有找到解决这个确切问题的方法。我的有序列表项既有前导数字又有黑色方块。我希望它们只有一个前导数字,并消除黑色方块。可能有另一个更高级别的样式表控制 . 的外观li,但我想用本地内联样式覆盖它。

HTML:

<ol>
  <li>Light all of the blah blah blah.</li>
  <li>Close the hood and blah blah blah.</li>
  <li>Turn off the  blah blah blah.</li>
  <li>Once the grill has  blah blah blah.</li>
</ol>

我试过了:

ol{
list-style-type:none;
list-style:none;
}
li{
list-style:none;
list-style-type:none;
}

...结果:只有正方形。

ol{
list-style-type:decimal;
list-style:none;
}
li{
list-style:none;
list-style-type:none;
}

...结果:只有正方形。

ol{
list-style-type:decimal;
list-style:decimal;
}
li{
list-style-type:decimal;
list-style:none;
}

...结果:只有正方形。

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

...结果:数字和正方形。

我还尝试了一个特定的伪类(我认为这是正确的术语):

li.mine{
list-style-type:decimal;
list-style:decimal;
}

...等等,哪个。仍然产生前导数字和正方形。

<ol>
  <li class="maintenance">Light all of the blah blah blah.</li>
  <li class="maintenance">Close the hood and  blah blah blah.</li>
  <li class="maintenance">Turn off the  blah blah blah.</li>
  <li class="maintenance">Once the grill has  blah blah blah.</li>
</ol>

更新: 显然,在主样式表中有一个li:before { content: "■"; }

我添加li:before{ content: "" }了本地内联样式,这样就摆脱了正方形。感谢 JoshC。

4

1 回答 1

3

可能是一个:before伪元素导致了正方形。

要么删除它,要么添加以下内容:

li:before {
    content:"";
}
于 2013-09-16T16:30:47.157 回答