0

I'm building a website, and I just have to make a welcoming page. It's a simple page: just a background with a button, which directs to our homepage. I just have one problem with the background: my background is too big. How can I edit with CSS and HTML so that my wallpaper fits all the screens? (I want to make the page unscrollable.) All I have so far in the CSS:

body{
    background-image:url("voorpagina.jpg")

}

Thanks a lot!

P.S. I've already tried background-size:cover; but it didn't seem to work?

anhnl
  • 21
  • 5
  • try `background-size:cover` for entire page and `background-size:100%` for screen – Akshay Jan 29 '15 at 13:08
  • `background-size: cover;` will work _as long as_ your `body` is 100% height of the viewport which it wont be by default. `html,body {min-height: 100% }` will probably fix it. – Turnip Jan 29 '15 at 13:20
  • Thanks! I can see the image now, but I want to scale it, so that I get a non-scrollable page, and so that people see the whole image, (my image is too big, so everybody sees like 70% of the image). Thanks for your quick reply! – anhnl Jan 29 '15 at 13:34
  • It worked for me! Thanks everybody for replying!! – anhnl Jan 29 '15 at 13:53

1 Answers1

0

body{ background: url("voorpagina.jpg") no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }

this should work if not you could use media-quires,

similar to your question 1

similar to your question 2

Community
  • 1
  • 1
  • Thanks for the quick reply! I've already saw this on other sites and I tried it too, but I don't know why it doesn't work for me:(. -o-background-size; doesn't seem to work? – anhnl Jan 29 '15 at 13:39
  • on which browser are you testing? `max-width: 100%; height: auto; width: auto;` try this, it worked for me – Sandeep kumar H R Jan 29 '15 at 13:54
  • Google chrome, I use Notepad ++ to edit the code, but I already fixed the problem! Thanks for your help though, I really appreciate it!:) – anhnl Jan 29 '15 at 13:55