css - 删除 HTML 列表中的缩进

标签 css indentation

我正在为移动网站开发动态 HTML 列表。基本概念有效,但我想删除列表一侧的间距。我试过 margin-leftpadding-left,但还是不行。

示例:

/* Now */
    List1
    List2
    List3

/* And I want */
List1
List2
List3

最佳答案

Safari 上的计算样式 <ul>

display: block;
font-family: 'Lucida Grande', Arial, Helvetica;
font-size: 12px;
height: 30px;
list-style-type: disc;
margin-bottom: 12px;
margin-left: 0px;
margin-right: 0px;
margin-top: 12px;
padding-bottom: 0px;
padding-left: 40px;
padding-right: 0px;
padding-top: 0px;
width: 795px;

对于 <li> (如你所见,大部分继承自父级 <ul> )

display: list-item;
font-family: 'Lucida Grande', Arial, Helvetica;
font-size: 12px;
height: 15px;
list-style-type: disc;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
text-align: -webkit-auto;
width: 795px;

Padding-left(也是继承的);

padding-left: 40px;

将它设置为更低的值:

padding-left: 0px;

关于css - 删除 HTML 列表中的缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15481211/

相关文章:

css - 是什么原因造成的,我该如何摆脱网页上这条奇怪的白线?

html - 在 Skeleton 中将 div 居中

html - 填充设置为 0 但仍然存在填充

html - 你能让 ERB 在渲染时正确缩进吗?

python - 列表列表,我似乎无法正确缩进

phpstorm - 使用 IdeaVim 和 Phpstorm 缩进文本 block 的快捷键

c - Emacs、C 宏反斜杠停止

html - 每个浏览器都支持所有 unicode 吗?

css - Vuetify,文本字段旁边的对齐按钮

python - Pep8 和多行 while 条件