CSS background property | css background
ExampleSetdifferentbackgroundpropertiesinonedeclaration:body{ background:lightblueurl("img_tree.gif")no-repeatfixedcenter;}TryitYourself»[1]DefinitionandUsageThebackgroundpropertyisashorthandpropertyfor:Itdoesnotmatterifoneofthevaluesabovearemissing,e.g.background:#ff0000url(smiley.gif);isallowed.Showdemo❯[2]Defaultvalue:seeindividualpropertiesInherited:noAnimatable:yes,seeindividualproperties.Readaboutanimatable[3]Tryit[4]Version:CSS1+newpropertiesinCSS3JavaScriptsyntax:object.style.backgr...
ExampleSet different background properties in one declaration:
body { background: lightblue url("img_tree.gif") no-repeat fixed center; }
Try it Yourself »[1] Definition and UsageThe background property is a shorthand property for:
It does not matter if one of the values above are missing, e.g. background:#ff0000 url(smiley.gif); is allowed.
Show demo ❯[2]
Default value: see individual properties Inherited: no Animatable: yes, see individual properties. Read about animatable[3] Try it[4] Version: CSS1 + new properties in CSS3 JavaScript syntax: object.style.background="red url(smiley.gif) top left no-repeat" Try it[5] Browser SupportThe numbers in the table specify the first browser version that fully supports the property.
Property background 1.0 4.0 1.0 1.0 3.5Note: See individual browser support for eac...