CSS tutorial: Background attribute Application

Source: Internet
Author: User
BACKGROUND Background

CSS description

Background-image: URL ("image URL"); background image

Background: URL ("image URL"); background

Background-color: # color code; background color

Exp:

Background-image: url(background image .jpg, GIF, BMP );

Background-color: # ffffff;

Background-color: transparent; <-- set the background to transparent

Background-repeat

CSS

Description

Repeat background image side by side

Repeat-X background image side by side in X direction

Repeat-y background image side by side in Y direction

No-repeat background images are not processed side by side

Exp:

Background-image: URL ("http://webdesign.chinaitlab.com/UploadFiles_8014/200903/20090323115920230.gif ");

Background-repeat: No-Repeat;

Take Effect

Does background-attachment fix the image position?

CSS

Description

When scroll pulls the scroll, the background image will move along (default)

When fixed pulls the scroll, the background image will not move

Exp:

Background-image: URL ("http://webdesign.chinaitlab.com/UploadFiles_8014/200903/20090323115920230.gif ");

Background-repeat: No-Repeat;

Background-Attachment: fixed;

Take Effect

Locate the background-position: x y in length

Use percentage to locate background-position: X % Y %

CSS

Description

Shift X % to the right

Y % Move down

Backgroud-position: 0% 0%; top left

Backgroud-position: 0% 50%; middle left

Backgroud-position: 50% 0%; upper center

Backgroud-position: 50% 50%; Median

Backgroud-position: 100% 0%; top right

Backgroud-position: 0% 100%; bottom left

Backgroud-position: 100% 50%; middle right

Backgroud-position: 50% 100%; bottom center

Backgroud-position: 100% 100%; bottom right

Locate with keywords

Keyword description

Top (y = 0)

Center (x = 50, y = 50)

Bottom (y = 100)

Left (x = 0)

Exp:

Background-position: center;

The image is in the center of the specified background x = 50% y = 50%

Background-position: 200px 30px

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.