首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >元素顶部和底部的空白

问元素顶部和底部的空白
EN

Stack Overflow用户
提问于 2015-09-27 12:07:37
回答 1查看 90关注 0票数 0

在元素的顶部和底部有一个空白区域,上面写着"SoundCloud Player“。它不应该出现在那里,我只是希望它在顶部没有空白处。我该怎么摆脱它呢?

代码:

代码语言:javascript
复制
<div class="content2">
  <div class="twitterfeed">
    <h3>Twitter Feed</h3>
  </div>
  <div class="recent">
    <h3 class="text3">Recent News<span class="slash">   /   </span><span class="text4">Get updates from us!</span></h3>
  </div>
  <div class="readnews">
    <a class="readall" href="themes.goodlayers2.com/musicclub/blog-full-with-right-sidebar/">Read All News</a>
  </div>
</div>
<div class="twittercontent">
<!-- twitter post embed code here -->
</div>
<div class="soundcloudplayer">
  <h3>
    SoundCloud Player
  </h3>
<style type="text/css">
.content2 {
  background: #191919;
  padding-left: 25px;
  padding-right: 20px;
}

.twitterfeed {
  float: left;
  padding-left: 140px;
  color: white;
  font-size: 30px;
  font-family: Didot, Georgia, sans-serif;
}

.recent {
  display: inline-block;
  padding-left: 230px;
}

.readnews {
  float: right;
  color: white;
  padding-right: 230px;
}

.text3 {
  color: white;
  font-family: "Goudy Old Style", Optima, sans-serif;
  font-size: 35px;
  margin-bottom: 0;
}

.text4 {
  font-size: 30px;
  color: #6CB9D9;
}

.readall {
  text-decoration: none;
  color: white;
  transition: color 0.2s ease-out;
}

.readall:hover {
  color: #6CB9D9;
  transition: color 0.2s ease-in;
}

.soundcloudplayer {
    background: #191919;
    color: white;
}
</style>
EN

回答 1

Stack Overflow用户

发布于 2015-09-27 12:09:36

您只需删除h3元素上的默认边距:

代码语言:javascript
复制
h3 {margin: 0;}

那些默认的上边距和下边距由于“边距崩溃”而挂在容器之外。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32804470

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档