jquery - Scale an image if the browser height or width changes but stay in proportion -


i'm trying make first responsive website, i'm trying design landing page text , images resize depending on browser size.

i have done text can't figure out how image.

here's fiddle site far: http://jsfiddle.net/581eg1cx/1/

you'll notice text gets smaller depending on height , width, need same image.

i.e if browser height goes smaller image scale down while not overlapping or going under text , staying centre, same goes width.

here's css image part, rest can found in fiddle.

.big-logo {    max-width:auto;    height:auto;    position: absolute;    top: 20%;    left:50%;    font-size:18px;    background:blue;    -webkit-transform: translatey(-50%) translatex(-50%);    -ms-transform: translatey(-50%) translatex(-50%);    transform: translatey(-50%) translatex(-50%); }  .big-logo img {    width:100% !important;    height:100% !important;    display:block; } 

updated jsfiddle, think meant.

the image , container css should be:

.big-logo {    height:50%;    position: relative;    font-size:18px;    background:blue;    text-align:center; }  .big-logo img {    max-width:100%;    max-height:100%;    width:auto;    height:auto; } 

i modified main-text css well, have look.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -