-1

I need help reducing the background-size code to be inside the background property.

Code:

<html style="background:black url('http://example.com/image.jpeg')center no-repeat;background-size:auto 125%;cursor:none">

My attempt:

<html style="background:black url('http://example.com/image.jpeg')center auto 125% no-repeat;cursor:none">

Any other way to reduce the code will be appreciated. Also, no need to tell me about the < /html>.

1 Answers1

2

The official W3C spec for the background shorthand property is here: https://www.w3.org/TR/css3-background/#the-background

The size property is written in the shorthand after the background-position and a forward slash. Example:

p { background: url("chess.png") 40% / 10em gray round fixed border-box; }

Is equivalent to:

p {
  background-color: gray;
  background-position: 40% 50%;
  background-size: 10em 10em;
  background-repeat: round;
  background-clip: border-box;
  background-origin: border-box;
  background-attachment: fixed;
  background-image: url(chess.png) }
Jon Uleis
  • 17,693
  • 2
  • 33
  • 42