我试图将一个元素置于底部块div中,但它保持在左侧。这是我的代码:
.logo {
display: inline-block;
height: 100px;
width: 100px;
padding-bottom: 10px;
}
.logo img {
box-sizing: padding-box;
display: block;
width: 100%;
height: auto;
margin: 0 auto;
}

<div class="bottom_block">
<a class="logo" href="#">
<img src="Style/img/logo_uniqa.jpg" alt="logo">
</a>
</div>
&#13;
我该如何解决这个问题?
答案 0 :(得分:4)
试试这个:
.logo {
display: block;
padding-bottom: 10px;
}
.logo img {
display: block;
margin: 0 auto;
}
<div class="bottom_block">
<a class="logo" href="#">
<img src="http://placehold.it/100x100" alt="logo">
</a>
</div>
答案 1 :(得分:3)
尝试添加此css:
.bottom_block{
text-align:center;
}