Рубрики

picture

Picture with a crimson background

This page was last modified on Jul 18, 2023 by MDN contributors.


background

The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat method. Component properties not set in the background shorthand property value declaration are set to their default values.

This property is a shorthand for the following CSS properties:

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

Syntax

/* Using a */ background: green; /* Using a and */ background: url("test.jpg") repeat-y; /* Using a and */ background: border-box red; /* A single image, centered and scaled */ background: no-repeat center/80% url("../img/image.png"); /* Global values */ background: inherit; background: initial; background: revert; background: revert-layer; background: unset; 

The background property is specified as one or more background layers, separated by commas.

The syntax of each layer is as follows:

  • Each layer may include zero or one occurrences of any of the following values:
    • The value may only be included immediately after , separated with the ‘/’ character, like this: ” center/80% “.
    • The value may be included zero, one, or two times. If included once, it sets both background-origin and background-clip . If it is included twice, the first occurrence sets background-origin , and the second sets background-clip .
    • The value may only be included in the last layer specified.

    Values

    See background-clip and background-origin . Default: border-box and padding-box respectively.

    See background-color . Default: transparent .

    The following three lines of CSS are equivalent:

    background: none; background: transparent; background: repeat scroll 0% 0% / auto padding-box border-box none transparent; 


    Accessibility concerns

    Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page’s overall purpose, it is better to describe it semantically in the document.

    • MDN Understanding WCAG, Guideline 1.1 explanations
    • Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0


    Red Backgrounds for Advertisement

    Catch your customers’ attention at the very glance of the red background ads on your pages. Our red pictures are free for every marketer to use as an advertisement source. You can download our high-quality red images and backgrounds to design for your advertising posters or sale ads to promote your products and boost sales.

    Customize red background christmas card in fotor

    Use Red Backgrounds to Spice Up Holiday Atmosphere

    Season the holiday spirit with red backgrounds. You can use our aesthetic red backgrounds as the Christmas card design materials to share your best wishes with your families and friends when celebrating Christmas. Choose the red photo you like, and click the edit icon to customize the red background with other elements, including Christmas messages and stickers. Moreover, you can add your transparent png as the design materials for the red photo backdrops to add extra fun to the holiday cheer!

    Add red background to the perfume product in fotor

    Add Red Background Images to Product Photography

    For some cosmetics product photos, try our red backgrounds to make your product eye-catching enough. Upload your product photography to our background changer, our AI tool will automatically remove image background and replace it with the red background you choose. It takes a few seconds to add red aesthetic pics, and you can have stunning product images for your e-commerce!

    Set red heart background as the mobile and pc wallpaper in fotor

Colin Wynn
the authorColin Wynn

Leave a Reply