css3 - css image autoresize not working -


i trying 2 columns :

  1. one div called words ,
  2. other ul called snaps has li of images

currently when resize images instead of resizing moves next row...how them resize based on screen width

below example

<div class="main">     <div class="subfooter">     <div class="words">         test messgae         </div>          <ul class="snaps">         <li><img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:and9gcr6hip-1dv221es0hk1e9ouqmzcavdw51paj4t0-zrzfxkgxmuxfa"/></li>         <li><img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:and9gcr6hip-1dv221es0hk1e9ouqmzcavdw51paj4t0-zrzfxkgxmuxfa" /></li>           <li><img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:and9gcr6hip-1dv221es0hk1e9ouqmzcavdw51paj4t0-zrzfxkgxmuxfa"/></li>          <li><img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:and9gcr6hip-1dv221es0hk1e9ouqmzcavdw51paj4t0-zrzfxkgxmuxfa" /></li>          </ul>     </div>   </div> 

below working example fiddle

this should looking :

fiddle

you need specify width of <li> elements , can use width:100%; height:auto; on images resize according width of <li> elements.

css :

.main {     width: 100%;     height: auto;     float: left;     display: inline-block;     position: relative; }  .subfooter {     width: 100%;     background-color: #99cc66;     margin-top: 0px;     margin-right: 0px;     margin-bottom: 0px;     margin-left: 0px;     float: left;     display: block; }  .words {     float: left;     width: 45%;     display: inline-block;     background-color: #996633;     padding-left: 20px;     padding-right: 20px;     margin-left: 50px; } .snaps li {     width: auto;     float: left;     display: block;     padding-top: 5px;     padding-right: 5px;     padding-bottom: 5px;     padding-left: 5px;     box-sizing:border-box;     width:50%; } .snaps li img {     width:100%;     height:auto; } .snaps {     width: 45%;     margin-top: 0px;     margin-right: 0px;     margin-bottom: 0px;     margin-left: 0px;     float: left;     display: inline-block;     list-style-type: none; } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -