CSS Basics – everything you need to know

Today, 20th March 2023, Ukraine is still bravely fighting for democratic values, human rights and peace in whole world. Russians ruthlessly kill all civilians in Ukraine including childs and destroy their cities. We are uniting against Putin’s invasion and violence, in support of the people in Ukraine. You can help by donating to Ukrainian's army.

Learn about CSS's most important properties on super-simple examples.

To set the foreground or text color of an element, use the color property:

<p id="sample">


#sample {
   color: red;

We specified red color so it will look like this:

Change foreground or text color of an element with color property

In 99% of cases, the color CSS property is used only to change the text color of elements.

To set the background or block color of an element, use the background-color property:


#sample {
   color: red;
   background-color: yellow;

background-color CSS property

Ivan Borshchov profile picture
Mar 30, 2021
by Ivan Borshchov
Did it help you?
Yes !

Best related