CSS list-style-type not working

一世执手 提交于 2019-12-04 09:03:03

问题


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>

回答1:


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

list-style-position: inside;



回答2:


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;




回答3:


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




回答4:


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 😳




回答5:


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



来源:https://stackoverflow.com/questions/12447611/css-list-style-type-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!