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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -