Html CSS 列表样式类型不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12447611/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CSS list-style-type not working
提问by SeinopSys
I have set the list-style-type
in CSS, but for some reason it's not showing it.
我已经list-style-type
在 CSS 中设置了,但由于某种原因它没有显示出来。
body {
margin: 0;
}
ol {
list-style-type: decimal;
padding-left: 0;
}
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
回答by Niet the Dark Absol
Because of your padding reset, the numbers are actually off to the left of the page. Try adding:
由于您的填充重置,数字实际上位于页面左侧。尝试添加:
list-style-position: inside;
回答by Musaddiq Khan
display:list-item;
list-style-position:outside;
It may give problem if list display:
attribute is set to some thing else than display:list-item;
如果列表display:
属性设置为其他内容,则可能会出现问题display:list-item;
回答by noel
回答by Loreena
If nothing of this work, make sure you don't have elements explicitly marked as display block inside the LI. It just happened to me with a H4 A set as block inside the LI. I was about to resign
如果这些都不起作用,请确保您没有在 LI 中明确标记为显示块的元素。它只是发生在我身上,将 H4 A 设置为 LI 内的块。我正要辞职
回答by talentedandrew
just remove "display : block;" from your li element
只需删除“显示:块;” 来自你的 li 元素
回答by ellelle
In my case it wasn't working with <ul>
.
就我而言,它不适用于<ul>
.
I suspected it was possibly because of a CSS reset file I was using.
我怀疑这可能是因为我使用的 CSS 重置文件。
I set the ul { display:list-item; }
as suggested above, and it just worked fine.
我ul { display:list-item; }
按照上面的建议设置了,它运行良好。
Check if you are using any reset files. They could be tricky at times.
检查您是否正在使用任何重置文件。他们有时可能会很棘手。