dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


advertisement
 

CSS: Color and Backgrounds : Page 2

Learn about color values and images for backgrounds.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Background Color: {background-color: colorname/hexvalue/rgb(R%, G%, B%)}
The background-color property specifies a background color. The background of an element is the space around the element. For example, the background of a headline is a bar, the depth and length of the headline text. The background of the body is the entire page.

Example: This sets a style rule for the background color of a head level one:


	h1 {background-color: darkcyan}

Project Cool

Background Image: {background-image: url(urlname)}
The background-image property specifies what image to display in the HTML element's background area. It calls the image by its relative or full URL.



Example: This sets a style rule that calls an image named "ocean.gif" as the background for the table element:


	table {background-image: url(../images/ocean.gif)}

Background Image Repeat: {background-repeat: repeat/repeat-x/repeat-y/no-repeat}
The background-repeat property specifies how and if a background image gets repeated. The image can repeat:

  • In both X and Y directions

  • In just the X direction

  • In just the Y direction

  • In no direction. You can prevent the background image from repeating at all.

Example: This sets a style rule that calls an image named "ocean.gif" as the background for the body element and repeats it in both the X and Y directions:


	body {background-image: url(../images/ocean.gif);
	      background-repeat: repeat}


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date