From the course: CSS: Enhancing Website Graphics

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Add background color

Add background color - CSS Tutorial

From the course: CSS: Enhancing Website Graphics

Start my 1-month free trial

Add background color

- [Instructor] In the last video we explored how colors can be defined using color names or color values. In this video we'll learn how to apply a color to an element background. Background colors are defined using the CSS background-color property, where the color is either a color name or a color value, using either the RGB or HSL color value system. We'll start with a very basic web page that consists of a single div element with the id main. I want to be able to distinguish the main div element from the page body and the browser window background. Since our html file doesn't contain any text content, remember this is an extremely basic page, I'll visually distinguish the different parts of this web page by setting the background color each web page using the background-color property. We'll put the style rules that define the background colors in the file background.css. In the background.css style sheet file we have no style rules defined yet. So let's start with the style rule…

Contents