CSS background | background color hex
ExampleSetthebackgroundcolorforapage:body{background-color:coral;}TryitYourself»[1]More"TryitYourself"examplesbelow.DefinitionandUsageThebackground-colorpropertysetsthebackgroundcolorofanelement.Thebackgroundofanelementisthetotalsizeoftheelement,includingpaddingandborder(butnotthemargin).Tip:Useabackgroundcolorandatextcolorthatmakesthetexteasytoread.Showdemo❯[2]Defaultvalue:transparentInherited:noAnimatable:yes.Readaboutanimatable[3]Tryit[4]Version:CSS1JavaScriptsyntax:object.style.backgroun...
ExampleSet the background color for a page:
body {background-color: coral;}
Try it Yourself »[1]More "Try it Yourself" examples below.
Definition and UsageThe background-color property sets the background color of an element.
The background of an element is the total size of the element, including padding and border (but not the margin).
Tip: Use a background color and a text color that makes the text easy to read.
Show demo ❯[2]
Default value: transparent Inherited: no Animatable: yes. Read about animatable[3] Try it[4] Version: CSS1 JavaScript syntax: object.style.backgroundColor="#00FF00" Try it[5] Browser SupportThe numbers in the table specify the first browser version that fully supports the property.
Property background-color 1.0 4.0 1.0 1.0 3.5 CSS Syntaxbackground-color: color|transparent|initia...