Share and download high quality stock photos

Network sites: Free Tutorials  |  Free Templates  |  CSS Gallery Showcase  |  Royalty Free Textures

Advertise here

How to Set a Backgrounds Stylish?

Article by ginfop8 - July 19, 2008

Affecting the background of your pages, tables, and even block elements like the paragraph tags is easier than you think when using Cascading Style Sheets. Using CSS, you can: * set an image as a background to an element * indicate the tiling position of the background image * define the location of that image, like a watermark Background-color usage: background-color : <color value>; background-color : rgb(30%,30%,30%); background-color : transparent; Setting the color of your background is easy, and with CSS you can now use both hexadecimal values and RGB values. Plus, you can set some elements to have a transparent background color, so that the background will allow other colors to show through. You can set the background-color on most block elements in current browsers. Try this out in your Web page: <p style="background-color: #cc0000; color : #cccccc; width : 200px;"> The background color of this paragraph is a dark red. It was set using a paragraph tag with the style attribute background-color:#cc0000;. e.g. style="background-color:#cc0000;">

Examples of background-color. Before you begin using the following style elements in your documents, you should be aware that these elements are supposed to work on any block-level elements. Be sure to test them in the browsers you support, as some browsers only support these styles on the <body> tag. Background-image Usage: background-image : (URL); background-image : ; Write URL to a specific image to display as the background for your element. Test this out by putting the following code in your document: <p style="background-image : url(http://webdesign.about.com/library/graphics/bg-grid.gif); width : 200px;"> This paragraph uses the background-image element to create a grid pattern behind the paragraph. e.g. style="background-image : url(http://webdesign.about.com/library/graphics/bg-grid.gif);"

Examples of background-image. Background-attachment usage: background-attachment : fixed; background-attachment : scroll; If you use a background attachment of fixed, the background image will be held in one place like a watermark. Using the scroll type will set the image to scroll with the rest of the page. This is the default and standard for background images. Examples of background-attachment. Background-repeat usage: background-repeat : repeat; background-repeat : inherit; background-repeat : repeat-x background-repeat : repeat-y background-repeat : no-repeat The default behavior of Web backgrounds is to repeat endlessly. Thus background images often have to be very large to insure that they don't repeat incorrectly on larger monitors. This tag allows you to specify that a background image might repeat only on the x or y axis, or not repeat at all. Use this property on block-level elements as well. Examples of background-repeat. Background-position usage: background-position : value; background-position: vertical horizontal; Sets the location of the background image with one of these values: * top * bottom * left * right * center * length * percentage Examples of background-position. Once you understand all the different CSS elements you can use to affect the background of your pages and elements, you can combine them into one CSS element. The "background" element. Background Usage: background : color url(URL) attachment position repeat; Follow the instructions for the above elements to define your backgrounds as you would like them.
About the author
Did you find this article useful? For more useful tips & hints, Points to ponder and keep in mind, techniques & insights pertaining to Web Designing, Do please browse for more information at our website :- http://www.thedesignbuild.com http://www.webdesign.reprintarticlesite.com



Back to articles