bulleted list with different indentation

2019-03-27 01:55发布

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

  • List elements without the <ul> tags are
  • not indented
  • I would like to indent some elements, but the default distance is too much and the sans-indent is too little.

    2条回答
    甜甜的少女心
    2楼-- · 2019-03-27 02:10
    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.

    查看更多
    别忘想泡老子
    3楼-- · 2019-03-27 02:11
    <ul style="padding-left:20px">
        <li>Element 1</li>
        <li>Element 2</li>
    </ul>
    

    I think the default indentation is 40px, this halves it.

    查看更多
    登录 后发表回答