从中间css水平对齐图像

时间:2014-05-15 03:01:10

标签: html css

我阅读了很多关于垂直对齐的文章,但是如何从中间水平对齐3张图像?

 <div class="notification-from-picture">    <img src="images/1.jpg" class="img-circle" /> </div>
 <div class="notification-between-from-to"> <img src="images/2.jpg"/>                     <div>
 <div class="notification-to-picture">      <img src="images/3.jpg" class="img-circle"/>< /div>

3 images in a row, horizontally align

2 个答案:

答案 0 :(得分:2)

这样做就可以了:

 .notification-from-picture,
 .notification-between-from-to,
 .notification-to-picture 
  {  
   display: inline;
  }

答案 1 :(得分:1)

.notification-from-picture,
.notification-between-from-to,
.notification-to-picture {
     display: inline-block;
 }

然后像div那样在div周围放一个包装div

<div id="image-wrapper">
    <div class="notification-from-picture">    <img src="images/1.jpg" class="img-circle" /> </div>
     <div class="notification-between-from-to"> <img src="images/2.jpg"/>                     <div>
     <div class="notification-to-picture">      <img src="images/3.jpg" class="img-circle"/>< /div>
</div>

然后再做

#image-wrapper {
    text-align: center;
}