Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Set the Background Properties

Use the background property as a shorthand method to set multiple background properties in one declaration. The properties must be in the order: color, image, position, repeat but you can leave some properties out and the browser will use a default value for those properties.

Below is an example of using inline style to set the border properties for a div.

<div style="background: #b0ffb0 url(bkgndimg.gif) top right no-repeat">Text</div>

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text

These style rules result in a green background color with a purple image in the upper-right corner that does not repeat, but scrolls with the background.

background Syntax

background: color image position size repeat origin clip attachment
PropertyDescription
colorbackground color
imagebackground image
positionposition of background image
sizesize of the background image
repeatno-repeat|repeat|repeat-x|repeat-y
originposition area of the background image
clippainting area of the background image
attachmentwhether the background image is fixed or scrolls

One more attribute you can specify at end of the background property is inherit (requires no value). If the parent element sets the background property and the child element sets the background property, leaving out a value, the child element will use the value set in the parent.

More CSS Quick Reference:
• Specifying Color
• Set an Element's Margin
• Set an Element's Overlap (z-index)
• Use word-wrap Property to allow Line Breaks in the Middle of Words
• position:absolute
• Set the Border Color
• Use an Embedded Style Sheet
• Set the Background Properties
• Set the Background Color
• CSS background-origin Positions Background

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro



Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2024 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268