7

there is this background-image i have in my div element and I want it to "fill" upwards/downwards and cover its entire height and width. Please explain me how this is possible with CSS. Any help is greatly appreciated.Thanks in advance.

stranger
  • 143
  • 2
  • 12

1 Answers1

3
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;

Documentation from CSS Tricks: http://css-tricks.com/perfect-full-page-background-image/

wildandjam
  • 502
  • 2
  • 7
  • Thanks a lot wildandjam, it works fine for filling "up" how about the same effect for filling the background image downwards. Thanks again. – stranger Jun 19 '14 at 07:40
  • You'd have to make your div (or whatever element you want the background added to), 100% height. To do this, you may have to change your position attribute to fixed or absolute. So try adding: `position:fixed;height:100%;width:100%;` – wildandjam Jun 19 '14 at 07:42