Himmators
Himmators

Reputation: 15036

Body background 100% of document width?

I have a body background that scales the entire width of the page.

Currently, it's set to background-size: 100% 50px;

The 100% works great for big screens: the background spans the width of the page as intended. I'm looking for something that applies to smaller screens(and mobiles!) aswell.

Upvotes: 0

Views: 1105

Answers (2)

Ehs4n
Ehs4n

Reputation: 802

Move the code to html

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

Upvotes: 1

Himmators
Himmators

Reputation: 15036

I moved the background from body{} to html{}

Upvotes: 1

Related Questions