0

How can i place the container to the center of the screen horizontally. The container has 8 images to be placed. All the images are to be aligned to a single line and should change accordingly to screen resolution.

Here is my HTML

<div id="container">
    <div id="list"   >
        <img src="img/c1.png" style="display:box; width:125px; margin-left:5px; margin-top:9px" />
        <img src="img/c2.png" style="display:box; width:125px;margin-left:5px;margin-top:9px"/>
        <img src="img/c3.png" style="display:box; width:125px;margin-left:5px;margin-top:9px" />    .
        .
        .
    </div>
</div>

CSS:

#container{margin-left: auto;margin-right:auto;width:1200px;}
viru48
  • 13
  • 1
  • 6

1 Answers1

2

Here, your improved CSS

Here the images will behave as text so this code is perfect for your requirement. (If something doesn't work out as you want, just leave a jsfiddle of your HTML and CSS so that we can se the live code.)

#container {
    position: relative;
    margin: auto;
    width:1200px;
}

#list img {
    display: inline-block;
}

#list {
    vertical-align: middle;
    text-align: center;
}
Santiago Baigorria
  • 700
  • 1
  • 6
  • 15