我想在页脚中为我的 Logo 创建一个链接,我通过 display:block
和 margin: 0 auto
将 Logo 居中,但是当我这样做时, a href
标签占据了整个页脚,就像我将宽度设置为 100% 之类的。
这是 css 示例
#footer{
height:60px;
position:absolute;
background-color:white;
bottom:0;
width:100%;
left:0;
}
#logo{
text-align:center;
width:50px;
height:auto;
bottom:0px;
padding-top:10px;
display:block;
margin: 0 auto;
position:relative;
}
HTML(使用了JADE模板引擎)
div#footer
a#gitlink(href='https://github.com/ZippoRays/slatkatajnamk2')
img#logo(src='randomimg')
最佳答案
将您的 CSS 更改为如下内容:
https://jsfiddle.net/0fqvf9oe/
即给你的 anchor display:block;
属性而不是图像:
#footer a {
display:block;
...
}
关于html - 一个 href 标签占据了整个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35121436/