I am trying to center three images on my page. The page consists on a fixed menu on the left of the page and a div
in which I want to display three photos (later it will be more photos) with float: left
property on my CSS
but centered horizontally, I mean that on the left and on the right of the photos have to be the same space. I want it to be responsive.
Here it is what I want:
┌───────────────────────────────────────────────────────────┐
| HEADER(The white space without anything by the moment) |
├──────────┬────────────────────────────────────────────────┤
| | DIV CONTAINER |
| | |
| | |
| | [SPACE] THE IMAGES [SPACE] |
| MENU | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
└──────────┴────────────────────────────────────────────────┘
Both spaces have to be equals.
I tried a lot of changes on my CSS
to get that behaviour but I could not get it. I also take as reference the answers on this question: Align image in center and middle within div but still does not work.
Here is my actually code:
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Title</TITLE>
<style type = "text/css">
body{
margin: 0;
}
#menu{
background-color: orange;
position: fixed;
text-align: center;
left: 0px;
top: 0px;
width: 120px;
height: 100%;
margin-top: 150px;
}
#container{
position: absolute;
left: 120px;
top: 150px;
width: 100%;
height: 100%;
text-align: center;
}
img.centeredImages{
display: inline-block;
width: 350px;
height: 200px;
float: left;
margin: auto;
}
#image1{
margin: 20px 20px;
}
#image2{
margin: 20px 10px;
}
#image3{
margin: 20px 8px;
}
</style>
</HEAD>
<BODY>
<div id = "menu">
<span class = "spanMenu"> HOME </span>
<span class = "spanMenu"> LOGS </span>
<span class = "spanMenu"> QUESTIONS </span>
</div>
<div id = "container">
<img class = "centeredImages" id = "image1" src = "https://porelplanetaphoto.com/noticias/wp-content/uploads/2015/10/34059861vEE.jpg">
<img class = "centeredImages" id = "image2" src = "http://orig11.deviantart.net/9675/f/2008/333/3/b/3b5dd04be82af929dd3070cb089bcf03.jpg">
<img class = "centeredImages" id = "image3" src = "http://cdn.wonderfulengineering.com/wp-content/uploads/2014/07/HD-landscape-Photographs.png">
</div>
</BODY>
</HTML>
Thanks in advance!