[英]HTML List-item spacing between number and text
I need to increase the spacing between the decimal and the text of an ordered list, but I am using a DL instead of an OL element. 我需要增加小数点和有序列表的文本之间的间距,但是我使用的是DL而不是OL元素。
With the margin-right of the ::before element I can adjust the spacing. 使用:: before元素的右边距 ,我可以调整间距。
HTML HTML
<dl>
<dt>Blah blah blah</dt>
<dd>Test test</dd>
<dt>Blah blah blah</dt>
<dd>Test test</dd>
<dt>Blah blah blah</dt>
<dd>Test test</dd>
</dl>
CSS CSS
dl {
list-style: decimal inside;
}
dt {
font-size: 1.2em;
border-bottom: 1px solid #444;
}
dt::before {
display: list-item;
content: ' ';
float: left;
margin-right: 20px;
}
dt:not(:first-of-type) {
margin-top: 10px
}
Here is the jsfiddle of what I tried. 这是我尝试过的jsfiddle。 The spacing works, but the enumeration is not correct. 间距有效,但枚举不正确。 What am I doing wrong?? 我究竟做错了什么??
or you could use a combination or of content
counter
and counter-increment
and slap a margin on it. 或者您可以使用content
counter
和counter-increment
的组合或,然后在其上加上一个边距。
Move display:list-item
to dt{ display:list-item}
It worked for me by changing your code. 将display:list-item
移至dt{ display:list-item}
它通过更改代码对我有用。 Here is the link to the edited code: http://jsfiddle.net/Fym2G/5/ 这是编辑后的代码的链接: http : //jsfiddle.net/Fym2G/5/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.