Back to CSS Notes
Topic #20

Background Shorthand

The background shorthand packs all background properties into one declaration. It makes stylesheets shorter without losing clarity.


CSS background - Shorthand property

To shorten the code, it is possible to specify all the background properties in one single property. This is called a shorthand property.

Instead of writing:

body {
  background-color: #ffffff;
  background-image:
  url("img_tree.png");
  background-repeat: no-repeat;

  background-position: right top;
}

You can use the shorthand property background:

Example

body {
  background: #ffffff url("img_tree.png") no-repeat right top;
}

The background property is a shorthand property for the following properties:

  • background-color
  • background-image
  • background-position
  • background-size
  • background-repeat
  • background-attachment
  • background-origin
  • background-clip

If some of the property values are missing, they will be set to their initial (default) values.


All CSS Background Properties

Property Description
background Sets all the background properties in one declaration
background-attachment Sets whether a background image is fixed or scrolls with the rest of the page
background-clip Specifies the painting area of the background
background-color Sets the background color of an element
background-image Sets the background image for an element
background-origin Specifies where the background image(s) is/are positioned
background-position Sets the starting position of a background image
background-repeat Sets how a background image will be repeated
background-size Specifies the size of the background image(s)

Want to go beyond the notes?

Join Coding Now Tech Institute's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Background Shorthand – FAQs

Quick answers about learning Background Shorthand in CSS.

This free note from Coding Now Tech Institute explains Background Shorthand in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on Coding Now Tech Institute, including Background Shorthand, is 100% free with no signup required.
With focused practice, most students grasp Background Shorthand in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now