简体   繁体   English

在文本和行中添加空格 <li> <a>元件</a>

[英]Add space between text and line in <li><a> element

I've looked at various solutions in regards to this question, but they don't seem to apply. 我已经查看了有关此问题的各种解决方案,但它们似乎并不适用。

This is my simple HTML code: 这是我的简单HTML代码:

<ul>
<li><a href="index.php">Home</a></li>
<li><a href="games.php">Games</a></li>
<li><a href="trivia.php">Trivia</a></li>
</ul>

How do I increase the space between the text and the line underneath it? 如何增加文本和其下方的行之间的间距?

Use <br> or line-height css rules or simply do that to <li> css: 使用<br>line-height css规则,或简单地对<li> css这样做:

li
{ display:block;
  height:XXXX;
}

Add this to your css: 将此添加到您的CSS:

li {
    margin-bottom:5px;
}

Change 5px accordingly. 相应地更改5px

There are actually three or more ways.. here are the best three: 实际上有三种或更多的方法..这是最好的三种:

1. make 1.使
that will make a brake between them, like you just hitted enter key. 就像您刚刚按下Enter键一样,它们之间会刹车。 2. You can use li{padding-top:10px;padding-bottom:10px;} or just in html using 2.您可以使用li{padding-top:10px;padding-bottom:10px;}或仅在html中使用

ul> li style="padding-top:10px;padding-bottom:10px;">Home ul> li style =“ padding-top:10px; padding-bottom:10px;”>首页

You know what I mean, I cant write it correctly, cause it will do ul in that post.. 您知道我的意思,我无法正确编写它, 因为它将在该帖子中有用。

now , the third should be same as padding, but use "margin" instead 现在 ,第三个应该与padding相同,但是使用“ margin”代替

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM