Difference between revisions of "CSS: Backgrounds"
Line 1: | Line 1: | ||
+ | This page shows how to create and use backgrounds in CSS. | ||
+ | {{template:CSS}} | ||
+ | |||
==Background== | ==Background== | ||
You can use the <syntaxhighlight inline>background</syntaxhighlight> CSS property to modify the background of an element. The background consists of several parts. | You can use the <syntaxhighlight inline>background</syntaxhighlight> CSS property to modify the background of an element. The background consists of several parts. |
Revision as of 11:19, 23 December 2022
This page shows how to create and use backgrounds in CSS.
CSS |
Basics - Backgrounds - Text - Box Model - Selectors and Combinators - Pseudo-class and Pseudo-element - Gradients - Animations and Transitions - CSS in AoPS - List of Elements |
Background
You can use the background
CSS property to modify the background of an element. The background consists of several parts.
Background Color
The background-color
property modifies the color of the background. For example, the code
div{
background-color: red;
}
will create the following:
Background Image
You can use the background-image
property to use an image instead of a color/gradient:
div{
background-image: url('/image.png');
}