CSS list-style-type not working

2019-03-15 02:18发布

I have set the list-style-type in CSS, but for some reason it's not showing it.

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>

5条回答
家丑人穷心不美
2楼-- · 2019-03-15 02:38

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

查看更多
Melony?
3楼-- · 2019-03-15 02:39

Because of your padding reset, the numbers are actually off to the left of the page. Try adding:

list-style-position: inside;
查看更多
祖国的老花朵
4楼-- · 2019-03-15 02:46

Decimal is default for an "ol". No need to declare it. Also the numbers are there just falling off the side of the page i.e. invisible. Adjust your padding and get rid of the redundant declaration. See here

查看更多
一夜七次
5楼-- · 2019-03-15 02:47

just remove "display : block;" from your li element

查看更多
走好不送
6楼-- · 2019-03-15 02:51
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;

查看更多
登录 后发表回答