如何水平对齐元素?

时间:2014-03-14 21:16:11

标签: html css

我的案子中有一个奇怪的问题

我有类似

的东西
<div class='test'>
    <button class='btn'></button>
   <div class='nest'>
      more...
   </div>
</div>

我的css

.test{
   z-index: 100;
   position: absolute;
   bottom: 15px;
   left: 1%;
   width: 98%;
   min-width: 500px;
   height: 45px;
   background: url(images/botnav_bg_shim.png) repeat-x;
   border-radius: 3px;
}

.btn{
   margin-left: 2px;
   width: 128px;
   height: 48px; 
   background:url(images/bot.png) no-repeat;
}

.nest{
   display: inline-block;
   margin-left: 10px;
   height: 45px;
   padding-left: 17px; 
   background:url(images/nest.png) no-repeat;
}

我的问题是我的按钮元素将无缘无故地被迫向下移动50px。任何人都可以帮我这个吗?非常感谢!

1 个答案:

答案 0 :(得分:0)

删除或添加注释块(/ * ... * /)到

position: absolute;
.test

中的

相关问题