Reputation: 678
I want the background to be 100% on both height and width. But I don't want it to get stretched/distorted, I suppose the solution here would be to maintain aspect ratio while croping the extra space to keep the 100% value.. Is there a way to do this in HTML/CSS?
Upvotes: 0
Views: 798
Reputation: 1008
CSS has a property called background-size
which you can apply and give it the desired size, in pixels or percentage, or use cover
or contain
, as desired. You may read up on the differences on W3 Schools
Upvotes: 0
Reputation: 4313
Take a look at background-size:cover;
There's a good overview of methods here too: http://css-tricks.com/perfect-full-page-background-image/
Upvotes: 5