Automatically resize images with browser size using CSS -


i want (or some) of images getting resized automatically when resize browser window. i've found following code - doesn't though.

html

<!doctype html> <html lang="en">     <head>         <meta charset="utf-8" />         <meta name="viewport" content="width=device-width, initial-scale=1.0" />         <link rel="stylesheet" href="style.css" type="text/css" media="screen" />     </head>     <body>         <div id="icons">             <div id="contact">                 <img src="img/icon_contact.png" alt="" />             </div>             <img src="img/icon_links.png" alt="" />         </div>     </body> </html> 

css

body {     font-family: arial;     font-size: 11px;     color: #ffffff;     background: #202020 url(../../img/body_back.jpg) no-repeat top center fixed;     background-size: cover; }  #icons {     position: absolute;     bottom: 22%;     right: 8%;     width: 400px;     height: 80px;     z-index: 8;     transform: rotate(-57deg);      -ms-transform: rotate(-57deg);      -webkit-transform: rotate(-57deg);      -moz-transform: rotate(-57deg); }  #contact {      float: left;      cursor: pointer;  }   img {      max-width: 100%;      height: auto;  } 

how can have fullscreen design (with background-size: cover) , have div elements @ same position (% wise) when resizing browser window, size resizing (like cover doing background)?

to make images flexible, add max-width:100% , height:auto. image max-width:100% , height:auto works in ie7, not in ie8 (yes, weird ie bug). fix this, need add width:auto\9 ie8.

source: http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries

for example :

img {     max-width: 100%;     height: auto;     width: auto\9; /* ie8 */ } 

and images add using img tag flexible

jsfiddle example here. no javascript required. works in latest versions of chrome, firefox , ie (which i've tested).


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -