HTML Diff
0 added 0 removed
Original 2026-01-01
Modified 2026-03-09
1 <p>The background of an element can be set using separate properties: background-color, background-image, and so on. All of this can be quite cumbersome to code.</p>
1 <p>The background of an element can be set using separate properties: background-color, background-image, and so on. All of this can be quite cumbersome to code.</p>
2 <p>You can set the background using the shorthand property background, for which you can specify its components separated by spaces:</p>
2 <p>You can set the background using the shorthand property background, for which you can specify its components separated by spaces:</p>
3 background: [bc] [bi] [br] [bp] [ba]; /* Legend: [bc] - background-color [bi] - background-image [br] - background-repeat [bp] - background-position [ba] - background-attachment */<p>If any component is not specified, then the default value will be used. Below are examples.</p>
3 background: [bc] [bi] [br] [bp] [ba]; /* Legend: [bc] - background-color [bi] - background-image [br] - background-repeat [bp] - background-position [ba] - background-attachment */<p>If any component is not specified, then the default value will be used. Below are examples.</p>
4 background: #e74c3c; background: url("img.png") no-repeat; background: url("img.png") 10px 20px;<p>In the first example, the background color is assigned simply.</p>
4 background: #e74c3c; background: url("img.png") no-repeat; background: url("img.png") 10px 20px;<p>In the first example, the background color is assigned simply.</p>
5 <p>In the second example, a non-repeating background image is specified together with a default transparent background color. The image is positioned in the upper left corner.</p>
5 <p>In the second example, a non-repeating background image is specified together with a default transparent background color. The image is positioned in the upper left corner.</p>
6 <p>In the third example, a background image is specified together with its position. It is also assigned a default transparent background color and the specification to repeat in all directions.</p>
6 <p>In the third example, a background image is specified together with its position. It is also assigned a default transparent background color and the specification to repeat in all directions.</p>