如何水平对齐项目

时间:2016-08-12 23:54:50

标签: html css alignment

请帮我把这些盒子放在一起,而不是彼此叠加。这应该是如此简单,但由于某种原因,我无法弄明白。

https://jsfiddle.net/DShepherd79/6qsg8g1L/2/

<body>
   <div class="horAlign">
      <a class="rTableCell processMap"></a>
      <a class="rTableCell sharepoint"></a>
   </div>   
</body>

.horAlign{
   background-color:black;
   width: 500px;
   position: absolute;
}

.rTableCell{
   padding:25px;
}

/*images Start Here*/
.processMap {
   background:#08F80D no-repeat center;
   display:block;
   height:50px;
   width:50px;
}

.sharepoint{
   background-color:purple; no-repeat center;
   display:block;
   height:50px;
   width:50px;
}

/*Hover Images Start Here*/
.processMap:hover {
   background-color:red; no-repeat center;
}

.sharepoint:hover {
   background-color:blue; no-repeat center;
}

1 个答案:

答案 0 :(得分:1)

display:block更改为display:inline-block

请参阅https://jsfiddle.net/6qsg8g1L/3/