The background color of an element.
Syntax background-color: color | transparent | inherit ;
Color - A color name or hex code
transparent - Make the element see-through
inherit - Inherit from a parent element.
When setting the background color for Text it is strongly recommended to also set the font color in the CSS selector, this ensures that the text will remain readable no matter what the browser/device default Text color happens to be.
Examples:
body { background-color: #ff0084; }
.emw3class { background-color: rgb(255,0,0); }
#emw3id { background-color: #00ff00; }
Try it:
This is a sample of text with a CSS background color. |
(CSS 1) Browser Support: All major browsers.
“The business of the advertiser is to see that we go about our business with some magic spell or tune or slogan throbbing quietly in the background of our minds” ~ Marshall McLuhan
Related:
Background-color - MDN Web Docs.
Background-Attachment - Position of a background image relative to the page.
Background-Image - The background image for an element.
Background-Position - Starting position of a background image.
Background-Repeat - How a background image will be repeated.
background - A shorthand property for the properties above.
Background-Clip - The painting area of the background.
::selection - Format the background color of text when selected.
color - Text color.
Color chooser
opacity - Opacity level for an element.