html - How to use float and still have the child div inside the parent div? -
i want put 3 images @ center of page. in following code, when use float, image jumps out of parent div class "centered". there way can keep child div inside 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; }
you have add sudo element after .centered div clear float after it.
.centered:after{ content: ""; display:table; clear:both; }
Comments
Post a Comment