CSS background property background, css background

Source: Internet
Author: User
Tags id3

CSS background property background, css background

The background attribute is short for all background attributes:

These background attributes are as follows:

Background-color: background color

You can set it by the color name (red/green/blue ).

You can also use hexadecimal notation (# fff/#000/# bcbcbc)

You can also use rgb (x, x, x) x values (0 ~ 255)

Background-position: Start position of the background

There are also three value options. The first one is to combine the acronyms (top/right/bottom/left), such as left top

% X %. For example, 0% 0% indicates the upper left corner.

Expressed in pixels, for example, 100px 100px

Background-size: background size

You can adjust the background size by setting a given length, such as background-size: 100px 80px;

You can also set the percentage. Note that the percentage here refers to the background location area, rather than the original size of the image. Example: background-size: 50% 50%;

Background-repeat: Repeated background settings

No-repeat: no duplicates

Repeat-x: x (horizontal) duplicates

Repeat-y: y (vertical)

Repeat: repeated

Background-origin: Specifies the relative position of the background-position attribute.

Padding-box: relative position of the background fill box

Border-box: relative position of the background border

Content-box: the position of the content box relative to the background

<! Doctype html> 

Effect:

Background-clip: the area where the background is drawn.

It has three values: padding-box, border-box, and content-box.

<! Doctype html> 

 

Effect:

 

Background-attachment: whether the background is fixed or scrolling with the page

Fixed: fixed

Scroll: scroll (default)

Background-image: background image

Url: Image path

 

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.