I want to put three images at the center of a page. In the following code, when I use float, the image jumps out of the parent div with class "centered". Is there any way that I can keep the child div inside the parent div?
HTML:
<div class="centered">
<div id="M">
<img src="images/M.png">
<img src="images/M.png">
<img src="images/M.png">
</div>
</div>
CSS:
.centered {
margin-left: auto;
margin-right: auto;
border: 3px solid #73AD21;
width: 1500px;
}
.centered img {
display: block;
}
#M {
float:left;
}