andycl1
andycl1

Reputation: 67

Percentage Option in CSS Background Image

Can someone please let me know what the 20% does in the following style?!

background: url('header.jpg') no-repeat 20%;
padding:500px 0;
background-size: cover;
background-attachment: fixed;

Thanks.

Upvotes: 0

Views: 39

Answers (2)

j08691
j08691

Reputation: 208002

It sets the background-position-x property of the background image 20%, which moves the image to the right by 20%. Although using it with background-size: cover and background-attachment: fixed doesn't make a lot of sense.

See https://developer.mozilla.org/en-US/docs/Web/CSS/background-position

Upvotes: 0

Pepo_rasta
Pepo_rasta

Reputation: 2900

it should be position of background image:

background: color image position/size repeat origin clip attachment initial|inherit;

http://www.w3schools.com/cssref/css3_pr_background.asp

Upvotes: 1

Related Questions