How do I force my <a>
element with an image appear in center of my div
? And should I try to center an a
element first, so it work out?
<div class="col-md-6 logo">
<a class="navbar-brand" href="/index.html">
<img src="#">
</a>
</div>
答案 0 :(得分:0)
尝试style="text-align:center"
:
<div class="col-md-6 logo" style="text-align:center">
<a class="navbar-brand" href="/index.html">
<img src="#">
</a>
</div>
答案 1 :(得分:0)
将你的img设为类
在css中
img.example { margin : auto; }
答案 2 :(得分:0)
问题解决了,navbar-brand有 浮动:正确 默认情况下。所以我把它变成了 :没有; 和 text align:center;