Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
716 views
in Technique[技术] by (71.8m points)

margin-top不生效问题,父div,子 a


.page-foot {
 display: inline-block;
 border: 0px;
 width: 100%;
 height: 50px;
 position: fixed;
 bottom: 0;
}
.a-download {
 pointer-events: none;
 text-decoration:none;
 color: #FFFFFF;
 background-color: #1890ff;
 border-color: #1890ff;
 padding: 10px;
 margin-top: 10px;
}
<div class="page-foot">
 <a href="http://www.baidu.com"
 class="a-download"
 target="_blank" >下载</a>
</div>

里面的块超过了外面的块,不用浮动,position怎么解决,网上的方法试过了都没用,当然我最终是要flex的,超不超过似乎没关系


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

a标签是行内元素,margin只有左右有效,上下无效。把a标签的样式也加上inline-block即可。

.a-download{
  display:inline-block;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...