Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k 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 Reply

0 votes
by (71.8m points)

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...