我想删除所有缩进ul.我试着设置margin,padding,text-indent给0,却无济于事.似乎设置text-indent为负数就可以了 - 但这是否真的是删除缩进的唯一方法?
j08*_*691 379
设置列表样式并将左边距填充为空.
ul {
list-style: none;
padding-left: 0;
}?
Run Code Online (Sandbox Code Playgroud)
为了维护子弹,您可以替换list-style: none使用 list-style-position: inside或简写list-style: inside:
ul {
list-style: none;
padding-left: 0;
}Run Code Online (Sandbox Code Playgroud)
Jps*_*psy 86
我删除<ul>缩进的首选解决方案是一个简单的CSS单行程序:
ul { padding-left: 1.2em; }Run Code Online (Sandbox Code Playgroud)
<p>A leading line of paragraph text</p>
<ul>
<li>Bullet points align with paragraph text above.</li>
<li>Long list items wrap around correctly. Long list items wrap around correctly. Long list items wrap around correctly. Long list items wrap around correctly. Long list items wrap around correctly. </li>
<li>List item 3</li>
</ul>
<p>A trailing line of paragraph text</p>Run Code Online (Sandbox Code Playgroud)
该解决方案不仅轻巧,而且具有多种优势:
旧版信息:
对于IE 8及以下版本,您必须使用margin-left代替:
ul { margin-left: 1.2em; }
Run Code Online (Sandbox Code Playgroud)
小智 8
将其添加到您的CSS:
ul { list-style-position: inside; }
Run Code Online (Sandbox Code Playgroud)
这将把li元素放在与其他段落和文本相同的缩进中.
参考:http://www.w3schools.com/cssref/pr_list-style-position.asp
| 归档时间: |
|
| 查看次数: |
272464 次 |
| 最近记录: |