bulleted list with different indentation

一曲冷凌霜 提交于 2019-12-03 17:04:49

问题


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.


    回答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

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