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:
• Set the Font Variant
• Set an Element's Display Property
• Set The Cursor Style
• Set the Text Color
• Set the box-sizing Property
• Class Selector
• Set a Fixed Background Image
• Set an Element's Padding
• How to Use a CSS ID Selector
• Descendant Selector

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