CoderTools Web site

CSS Background Property

Description


The background style is a shorthand so you can set many of the background options in one go. Note if you do not provide a value for all the options the default will automatically be applied.
    background: 
        background-color 
        background-image 
        background-repeat 
        background-attachment 
        background-position;

Examples for Background


test text test text test text test text
    <style>
        #test { background:red; }
    </style>

    <div id="test">test text test text test text test text</div>

Values for <background>


Name Values Description
background-color red
#ff0000
rgb(100%,0%,0%)
transparent
Set the background color of the element.
background-image url(URL) e.g. url(images/image1.jpg)
none
Specifies an image to display in the background of the element
background-repeat repeat
repeat-x
repeat-y
no-repeat
Specifies the repeat style of the background image. repeat-x causes tiling to the left and the right, repeat-y causes tiling up and down
background-attachment scroll
fixed
Specifies if background image scrolls or is fixed when the page is scrolled
background-position

(note two values one for x and one for y
For y
   %|px|top|center|bottom
For x:
   %|px|left|center|right

e.g. top left
e.g. 50% right
e.g. 50% 20px
Specifies the position of the background image. Or if tiling then indicates the origin of the tiling


TotalEdit Now Completely Free

CoderTools TotalEdit - The Free Text Editor

A powerful editor and notepad replacement TotalEdit makes it easier to complete your file editing and software development tasks. TotalEdit is FREE for commercial and non-commercial purposes (its freeware).

8/19/2017 6:48:31 PM
Terms Of Use | Privacy Statement | Copyright 2006-2015 © Independence Software LLP