Html 项目符号列表行之间的间距
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15665505/
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
Spacing between bullet list rows
提问by iefpw
How do I set the spacing between bullet lists?
如何设置项目符号列表之间的间距?
- asdfasdf
- asdf23223
- 自卫队
- asdf23223
I want to put a little more space between the first and second rows like
我想在第一行和第二行之间多留一点空间,比如
<ul>
<li>asdfasdf</li>
<p />
<li>asdf23223</li>
</ul>
回答by mattytommo
Add top
and bottom
padding to the li
s, like so:
添加top
并bottom
填充到li
s,如下所示:
ul li { padding: 5px 0px; }
And take out that crazy looking <p />
tag.
并取出那个看起来很疯狂的<p />
标签。
回答by Floremin
I'm assuming <p />
tag is just a typo, it shouldn't be there ;)
我假设<p />
标签只是一个错字,它不应该在那里;)
Add this into your <head>
tag:
将此添加到您的<head>
标签中:
<style>
ul li { margin-bottom: 10px; }
</style>
回答by Mike Schwartz
You might be able to do something like this:
你也许可以做这样的事情:
<ul style="line-height:1.4;">
回答by gaynorvader
Use line-height
This will put spacing above and below the text.
使用line-height
这将在文本上方和下方放置间距。
回答by Hassaan
Use the CSS as:
使用 CSS 为:
li { padding: 10px 0px 0px; }
li:first-child { margin-bottom: 0px; }
回答by Heidi
I just use the so that it will not mess with the styles of all of my other pages when using html and php.
我只是使用 ,以便在使用 html 和 php 时不会干扰我所有其他页面的样式。
回答by ellipsis
You can use the pre
tag. No need for the css
您可以使用pre
标签。不需要css
<ul>
<pre>
<li>Foo</li>
<li>Bar</li>
<li>Baz</li>
</pre>
</ul>
回答by Eli
You can just add a margin-bottom
for your list item
您只需margin-bottom
为列表项添加一个