Bonding Through Coding

Background Color

background-color is a CSS property that allows you to change the background color of a webpage within your website. To change the colors, you can use the word i.e. ‘White’, the hex value, #ffffff , or the rgb value: rgb(255,255,255).

Example

Say I wanted to change the background color of the header of my website, I can use the following piece of code:

h1 {
    background-color: rgb(150, 0, 255);
}

This code tells my website that I am changing the background color of my header, h1, to purple using rgb values!

If you want to know more about the background-color property, you can go to the links at MDN Web Docs or w3schools. Both of these sites give excellent examples of the background-color CSS property that are interactive, and allow you to change and alter the values to see how the property works.

background-color: red;
background-color: #E16036;
background-color: rgb(239, 208, 158);
background-color: rgba(38, 28, 21, 0.7);
background-color: hsl(202, 78%, 67%);
background-color: hsla(65, 96%, 66%, 0.7);