Css tutorial: CSS background attribute application

Source: Internet
Author: User
Tags set background

The CSS background properties define the background effects of an element.
The background attribute of CSS can define background effects for elements.
Set background color Set the background color
This example demonstrates how to set the background color for an element.
Instance:

The code is as follows: Copy code
Body {background-color: yellow}
H1 {background-color: #00ff00}
H2 {background-color: transparent}
P {background-color: rgb (250,0, 255 )}

Title 1
Title 2
Section
[You can modify some code before running it to view the effect]
Set an image as the background
This example demonstrates how to set an image as the background
Instance:

The code is as follows: Copy code
Body
{
Background-image: url ('attachments/month_0612/52006129151936.jpg ')
}

[You can modify some code before running it to view the effect]
Duplicate background image How to repeat a background image
This example demonstrates how to repeat a background image.
Instance:

The code is as follows: Copy code
Body
{
Background-image:
Url ('attachments/month_0612/52006129151936.jpg ');
Background-repeat: repeat
}

[You can modify some code before running it to view the effect]
Background image horizontal repetition How to repeat a background image only horizontally
This example demonstrates how to repeat a background image only horizontally.
Instance:

The code is as follows: Copy code

Body
{
Background-image:
Url ('attachments/month_0612/52006129151936.jpg ');
Background-repeat: repeat-x
}

[You can modify some code before running it to view the effect]
How to repeat a background image only vertically

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.