我已经设置了我的边距和填充,submenu-img
以将工具栏图像对齐到中心,但似乎它没有 100% 对齐到中心,当我尝试恢复浏览器窗口时,工具栏对齐将失去形状。
我在 jsFiddle http://jsfiddle.net/AZdat/上做了一个演示
这是HTML源代码
<div class="submenu">
<div class="submenu-img">
<a href="abc.com"><div class = "icon-home"></div></a>
<a href="abc.com"><div class = "icon-groups"></div></a>
<a href="abc.com"><div class = "icon-members"></div></a>
<a href="abc.com"><div class = "icon-favorite"></div></a>
</div>
</div>
CSS
.submenu {
background-color: #353535;
overflow: hidden;
position: relative;
}
.submenu-img {
float: left;
position: inherit;
padding: 30px 0 30px 0;
margin-left: 20%;
margin-right: 20%;
}
.submenu-img .icon-home {
background-image: url(http://imageshack.com/a/img607/9549/j3oe.png);
background-repeat: no-repeat;
display: block;
position: relative;
height: 56px;
width: 41px;
margin: 0 55px 0 0;
float:left;
}
.submenu-img .icon-groups {
background-image: url(http://imageshack.com/a/img191/1220/9sb7.png);
background-repeat: no-repeat;
display: block;
position: relative;
height: 54px;
width: 49px;
margin: 0 55px 0 0;
float: left;
}
.submenu-img .icon-members {
background-image: url(http://imageshack.com/a/img62/4964/6spa.png);
background-repeat: no-repeat;
display: block;
position: relative;
height: 54px;
width: 64px;
margin: 0 55px 0 0;
float: left;
}
.submenu-img .icon-favorite {
background-image: url(http://img838.imageshack.us/img838/7659/ojv5.png);
background-repeat: no-repeat;
display: block;
position: relative;
height: 58px;
width: 78px;
margin: 0 55px 0 0;
float: left;
}