13CSS basics

CSS Backgrounds

Easy20MIN

CSS backgrounds enable the styling and customization of website backgrounds. There are several ways to define the appearance of a background in CSS, such as background color, background image, repeating images, gradients, etc. Below are examples of the usage of CSS backgrounds:

Setting background color

You can set the background color in CSS by using the background-color property. For example, if you want to set the background color to white, you can write the following rule:

CSS
1body {
2  background-color: white;
3}

This rule sets the page background color to white.

1 / 5
Hakatemia Pro

Learn to hack — start here

Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.