How to set different background properties in one declaration?
We are going to use the Shorthand property in this article to set different background properties.
- To reduce the length of the CSS code we can declare background properties in one line through “Shorthand Property”.
- Through this property we can define different properties of background in a single line instead of using background-color, background-image and other properties in multiple lines.
Shorthand properties allow you to specify a set of related CSS properties with a single property. They combine related properties into a shorthand form. In most cases, the browser sets a default value if you leave out an optional one
background: bg-color bg-image position/bg-size bg-repeat bg-origin bg-clip bg-attachment initial|inherit;
Example2: Shorthand property with multiple image