我创建了一些div并给它一些颜色,以便在编码时看到变化的差异,并看到每个框之间有一个很大的白色间距。 如何删除这些空格?
这里是我的小提琴:https://jsfiddle.net/Wosley_Alarico/8tgLzjeq/
HTML:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="content">
<ul>
<li><a id="deposit" href="#">Deposit</a></li>
<li><a id="account" href="#">Account</a></li>
<li><a id="credit" href="#">Credit</a></li>
</ul>
<div class="box deposit">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio sunt voluptates reprehenderit similique nostrum eius repudiandae odio eos obcaecati doloremque quam quos, officiis veritatis blanditiis soluta molestiae iusto illo corrupti.</p>
</div>
<div class="box account">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio sunt voluptates reprehenderit similique nostrum eius repudiandae odio eos obcaecati doloremque quam quos, officiis veritatis blanditiis soluta molestiae iusto illo corrupti.</p>
</div>
<div class="box credit">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio sunt voluptates reprehenderit similique nostrum eius repudiandae odio eos obcaecati doloremque quam quos, officiis veritatis blanditiis soluta molestiae iusto illo corrupti.</p>
</div>
</div>
<div id="random">
<p>This is a random text</p>
</div>
CSS:
li{
list-style:none;
color: white;
width: 30%;
a{
color: white;
text-decoration: none;
&:hover{
color: blue;
}
}
}
ul{
background: black;
padding: 20px 0;
text-align: center;
display: flex;
justify-content: center;
}
.box{
height: 200px;
}
.deposit{
background-color: green;
}
.account{
background: pink;
}
.credit{
background: blue;
}
li a.active{
color: red;
}
希望你能帮忙
答案 0 :(得分:1)
删除p
页边距并根据需要用填充替换它们:p{margin:0;}