Html 如何正确缩进无序列表?左边距不起作用!

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1920575/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:36:36  来源:igfitidea点击:

How do I indent an unordered list properly? margin-left won't work!

htmlcsshtml-lists

提问by brightmist.co.uk

Hi I'm creating an email but I'm not sure how to adjust the automated indent on the bullets. I'm sure theres a simple fix. Margin-left doesn't seem to work!

嗨,我正在创建电子邮件,但我不确定如何调整项目符号上的自动缩进。我确定有一个简单的修复方法。左边距似乎不起作用!

Thanks for your help Regards Judi

感谢您的帮助 问候朱迪

       .bullets{
        width:255px;
        color:white;
        font-size:11px;
        margin-right: 2em;
        list-style: none;
        line-height:15px;
        list-style: none;
        margin-left: 0;
        padding-left: 1em;
        display:inline;
    }

     <table class="bullets" border="0">
                <tr>
                  <td><ul>
                    <li> Select products 
</li>
                  </ul></td>
                </tr>
                <tr>
                  <td>
                    <ul>
                      <li> Incorporate </li>
                  </ul></td>
                </tr>
                <tr>
                  <td><ul>
                    <li> on site</li>
                  </ul></td>
                </tr>
              </table></td>

回答by graphicdivine

Less is more:

少即是多:

<ul>
    <li>Abc</li>
    <li>Def
       <ul>
           <li>Ghi</li>
           <li>Jkl</li>
       </ul>
    </li>
    <li>Mno</li>
</ul> 

回答by limitlessloop

You need to apply the margin-left: 0;to the liitself.

你需要应用margin-left: 0;li自身。

.bullets li {
margin-left: 0;
padding-left: 0;
}

You might find you also need to apply it to the ulaswell.

您可能会发现您还需要将其应用到该文件中ul

.bullets ul, .bullets li {
margin-left: 0;
padding-left: 0;
}

Check also that that tableand tddo not have any padding or margin applied to them.

还要检查tabletd没有对它们应用任何填充或边距。

.bullets, .bullets td, .bullets ul, .bullets li {
margin-left: 0;
padding-left: 0;
}

Hope this helps.

希望这可以帮助。

回答by Sarfraz

  .bullets{
    width:255px;
    color:white;
    font-size:11px;
    margin-right: 2em;
    list-style: none;
    line-height:15px;
    list-style: none;
    margin-left: 0;
    padding-left: 1em;
    display:inline;
}

<table class="bullets" border="0">
  <tr>
    <td>
    <ul>
      <li> Select products</li>
      <li> Incorporate </li>
      <li> on site</li>
    </ul>
    </td>
  </tr>
</table>

回答by DanDan

The Bullet indent should be controlled by margin-left.

Bullet 缩进应该由 margin-left 控制。