0
我有含有欲自举导航栏居中DIV中的锚标签
的高度和图像的宽度的div标签内的中心是未知的,所以我想中心的图像的锚其水平和垂直方向,而不必计算填充
<div class="navbar-header">
<a class="navbar-left" href="index.html"><span role="link" class="logo"></span></a>
</div>
.navbar-header{
width: 250px;
height: 60px;
float: left;
}
.navbar-left{
float: left!important;
}
.logo {
background-image: url(/image.png);
background-position: center;
background-size: 100%;
border: none;
display: block;
height: 51px;
width: 185px;
margin: 0;
text-indent: -9999px;
}
尝试增加'的text-align:center'到导航栏头 –
你已经尝试过的答案在这里:http://stackoverflow.com/questions/27037514/how-to-center-brand-image-in-navbar和这里:http://stackoverflow.com/questions/23400234/centering-brand-logo-in-bootstrap -3-导航栏 – ZimSystem