How to set url position and bg-size? for the CSS background property

MDN document: https://developer.mozilla.org.

looking at the document seems to mean writing three attributes directly

   .a{
   background: url("https://... ...") center cover;
   }

but the effect of actually writing it out is not right, so I want to

myself.
.a{
background: url("...") center;
background-size: cover;
}

has the effect, excuse me, how to write the effect with one line

Thank you. I didn"t read it carefully.


Yes, but add / , see

reference: https://www.w3.org/TR/css-bac.

.a {
  background: url("https://... ...") center/cover;
}

in fact, it is generally not recommended to write background together, but separately.


split method:
background-image:url ('.. / images/a.png');
background-repeat:no-repeat; or repeat-x or-y. ;
background-attachment: scroll;
background-position:0 0; or (50%) or (center) or (left center).
background-size:100% auto; or (cover) or (50%).
background-origin: content-box;
background-clip: padding-box;
background-color:-sharp666;

the following are abbreviations:

background:url (test3.jpg) no-repeat scroll 10px 20px/110px 130px content-box padding-box-sharpaaa;

it is suggested that writing separately is more intuitive. I hope it will be helpful to you. Thank you!

Menu