CSS background image to fit height, width should auto-scale in proportion

I want background image fit with the height of the div, there's a way to do that? background-size:cover; fit only with the width and height autoscale (I need the opposite effect). Thanks.


Solution 1:

I know this is an old answer but for others searching for this; in your CSS try:

background-size: auto 100%;

Solution 2:

background-size: contain; 

suits me

Solution 3:

try

.something { 
    background: url(images/bg.jpg) no-repeat center center fixed; 
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -100;  
}