Html 不同缩进的项目符号列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4549475/
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
bulleted list with different indentation
提问by sova
Can I make bulleted lists on my site that use <ul> and <li> tags have a different indentation distances?
我可以在我的网站上制作使用 <ul> 和 <li> 标签具有不同缩进距离的项目符号列表吗?
- Element One
- Element Two and even this line which is not in an <li> tag are indented
- 元素一
- 元素二 甚至这行不在 <li> 标签中的行也是缩进的
I would like to indent some elements, but the default distance is too much and the sans-indent is too little.
我想缩进一些元素,但默认距离太大而无缩进太小。
回答by thirtydot
<ul style="padding-left:20px">
<li>Element 1</li>
<li>Element 2</li>
</ul>
I think the default indentation is 40px
, this halves it.
我认为默认缩进是40px
,这将其减半。
回答by ebaum
li {
margin-left: 10px;
}
ul li{
margin-left: 20px;
}
A slightly cleaner way to adjust both of the indentations. Margin and padding differ, so use whichever suits you best.
一种更简洁的方法来调整两个缩进。边距和填充不同,因此请使用最适合您的那个。