CSS Basic: Background

Set the background color and images

Ckmobile
4 min readAug 9, 2021

In this article, we are focusing on the CSS background, we will talk about the different background properties.

Source code:

https://www.udemy.com/course/a-complete-css-course/?referralCode=D70F3923FF6501A398AA

Inside the page, we have a div with height and width are 300px.

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="styles.css"></head><body><div></div></body></html>

Background image

Add an image to the project folder, such as “crown.png”. Inside the CSS file, say

--

--