html - How to make a full width image responsive -


i have image header. here simple html:

<html>   <body>     <div class="wrapper" />   </body> </html> 

it fills full width of page, had specify height show up. here css:

.wrapper {   background-image: url(../assets/bridge.jpg);   background-repeat: no-repeat;   background-size: 100%;   width: 100%;   height: 250px; } 

how make image responsive? right when expand page gets point pic unrecognizable.

didn't got question quiet well, think missing value here

background-size: 100%; /* 1 value not wrong you'll need 2 */               --^--- 

css

.wrapper {   background-image: url(http://images.google.co.in/intl/en_all/images/logos/images_logo_lg.gif);   background-repeat: no-repeat;   background-size: 100% 100%;   width: 100%;   height: 250px; } 

demo

as ralph.m suggested, if using image website background, use background property on body element instead of div

you need use following css make background responsive

body {    background: url(bg.jpg) no-repeat center center fixed;    -webkit-background-size: cover;   -moz-background-size: cover;   -o-background-size: cover;   background-size: cover; } 

reference link


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -