
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
Set the background color of an element with CSS
To set the background color of an element, use the background-color property.
Example
You can try to run the following code to learn how to work with the background-color property:
<html> <head> <body> <p style = "background-color:blue;"> This text has a blue background color.</p> </body> </head> <html>
- Related Articles
- Set the background image of an element with CSS
- Set the opacity for the background color with CSS
- Add a red background color to an element to set danger action with Bootstrap
- Add a blue background color to an element to set key stuff with Bootstrap
- Add a green background color to an element to set positive action with Bootstrap
- Add a yellow background color to an element to set warning action with Bootstrap
- How to return the background color of an element with JavaScript DOM?
- Change the background color of a button with CSS
- Set the Background Attachment with CSS
- Set the Color of links with CSS
- Set the font stretch of an element with CSS
- Set the right margin of an element with CSS
- Set the top margin of an element with CSS
- Set the color of the border with CSS
- Set the color of the outline with CSS

Advertisements