html - Image overlap on css responsive page -


this first try @ responsive design , can't quite right. seen in first screenshot tower image overlaps div , i'm not sure i've done wrong. image here: http://postimg.org/image/l9ax77rhz/

the width of container 1170px , wanted trigger scaling of images , text once screen size dropped below point. image here: http://postimg.org/image/n420djzlj/ dropping below 760 sections begin overlap. want fix overlap , have images display first on small screens title , text below.

can explain me how or i've done wrong? html , css below

<style>   .lenovo-container {         width: 1170px;         height: 381px;         min-width: 858px;     }    .lenovo-container img {         float: left;         }    @media (max-width:1170px) {         img {              max-width: 100%;             height: auto;          }         .lenovo-container {             max-width: 100%    @media (max-width: 858) {         .lenovo-container p {             display: block;          }   } </style> <div class="lenovo-container">     <img class=" wp-image-1498 size-full alignnone" src="wp-content/uploads/2015/06/rack-server-e1434645252235.jpg" alt="rack server" width="500" height="381" />     <h2>rack servers</h2>     <p>lenovo thinkservers , system x rack servers ideal small medium-sized business , feature power-efficient designs, segmented workloads, , fit-for-purpose applications.</p>     <div class="product-button" style="vertical-align: bottom;">         <div class="button-inner-product"><a href="http://shop.lenovo.com/us/en/systems/servers/racks/" target="_blank">learn more</a>         </div>     </div>  </div> <br> <div class="aligncenter" style="width: 1170px; display: block; vertical-align: bottom">     <hr />     </div>  <div class="lenovo-container"> <img class="alignnone size-full wp-image-1565" src="wp-content/uploads/2015/06/lenovo-server-e1434648963684.jpg" alt="lenovo server" width="500" height="520" /> <h2>tower servers</h2> <p>lenovo tower servers provide performance, reliability, , easy-to-use tools manage file/print , point-of-sale workloads.</p> </div> 

the culprit float:left. try instead:

.lenovo-container {     width: 1170px;     height: 381px; /* if image getting cut off, it's large.                         try auto instead or remove property altogether. */     min-width: 858px;     overflow: hidden; }  .lenovo-container img {     float: left; } 

floats break element out of document flow, , float them left of elements. fix forces container respect bounds of float.

a cleaner fix is:

.lenovo-container:after {   display: table;   content: '';   clear: both; } 

if want image resize container, try this:

 @media (max-width:1170px) {     .lenovo-container img {       max-height: 100%;     }     .lenovo-container {         max-width: 100%     }  } 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -