[英]How to remove the space between a unordered list and a div
I was wondering how to remove the vertical space between a unordered list and div. 我想知道如何删除无序列表和div之间的垂直空间。 I know it's possible with using - margins, but I have a feeling that isn't really a clean method.
我知道使用-边距是可能的,但是我感觉这并不是一种干净的方法。
This is my code: 这是我的代码:
.menu { list-style-type: none; background-color: #660066; } .menu li { display: inline; padding-left: 40px; padding-right: 40px; } .div { width: 100%; height: 500px; background-color: #660066; }
<nav> <ul class="menu"> <li>Check 1</li> <li>Check 2</li> <li>Check 3</li> <li>Check 4</li> </ul> </nav> <article class="div">
Always do a reset like shown below for both UL and LI. 始终对UL和LI进行如下所示的复位。 That way spaces will only be present when you apply them by yourself.
这样,只有当您自己应用空格时才会出现空格。
ol, ul {
margin: 0;
padding: 0;
}
Click here to see why it is important to set a reset. 单击此处查看设置重设的重要性。
You have to set up your position since you are going to move in close proximity to the original location your position will be relative from there you move can move it up or down , it should look like this 您必须设置位置,因为您要移到原始位置附近,您的位置将是相对位置,从那里您可以向上或向下移动它,它应该像这样
.div .div
position:relative; 位置:相对;
bottom:30px; 底部:30PX;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.