css3 - How to maintain proportion on max width and fixed height? -


i trying make something this. top image 100% width of browser shorter 100%height of browser, content peeks little bit ( tops of 2 images below showing ).

also, when brower size scaled, maintains it's aspect ratio , 2 images show unless responsive breaking point @media screen , (min-width:768px) has of images stack on top of eachother.

here css:

.thumb-12 {     width: 100%;     height: 100%;     position: relative; } .thumb-12 img {     width:100%;     height: 100%;     max-height:700px;     background-position:center center;     -webkit-background-size:cover;     -moz-background-size:cover;     -o-background-size:cover;     background-size:cover;     background-repeat:no-repeat;     z-index:100; } 

this works until gets passed 1500px or width wise, starts stretch image.

is possible pure css?

i added wrapper div around image div, , gave overflow:hidden , fixed height of 700px; while keeping height of actual image 100%;

.thumb-wrapper {     max-height: 700px;     overflow: hidden; } .thumb-12 {     width: 100%;     height: 100%;     position: relative; } .thumb-12 img {     width:100%;     height: 100%;     height: auto;     background-position:center center;     -webkit-background-size:cover;     -moz-background-size:cover;     -o-background-size:cover;     background-size:cover;     background-repeat:no-repeat;     z-index:100; } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -