Aligning multiple images horizontally in the center of a div

前端 未结 2 1440
深忆病人
深忆病人 2020-12-14 01:47

I have a div and I want to align in the center of that div multiple images. All of the images have the same height and width of 16px. The problem is that I can either center

相关标签:
2条回答
  • 2020-12-14 02:05

    <div class="Image">FIRST</div>
    <div class="Image">SECOND</div>
    

    .ImageHolder{
    text-align:center;
    }
    
    .Image{
    display:inline-block;
    }
    
    0 讨论(0)
  • 2020-12-14 02:06

    Floating a block level item will push it to the left or right. "display:inline-block" on the IMG. And remove the float and position statements. Then "text-align:center" for the container div.

    http://jsfiddle.net/B6Jsy/

    I used a div as a fake img but it should work the same.

    0 讨论(0)
提交回复
热议问题