问题
Can I make bulleted lists on my site that use <ul> and <li> tags have a different indentation distances?
- Element One
- Element Two and even this line which is not in an <li> tag are indented
I would like to indent some elements, but the default distance is too much and the sans-indent is too little.
回答1:
<ul style="padding-left:20px">
<li>Element 1</li>
<li>Element 2</li>
</ul>
I think the default indentation is 40px
, this halves it.
回答2:
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.
来源:https://stackoverflow.com/questions/4549475/bulleted-list-with-different-indentation