Features of background (background) properties in CSS

Source: Internet
Author: User
This article brings the content is about CSS in the background (background) attribute introduction, there is a certain reference value, the need for friends can refer to, I hope to help you.

Shorthand Order: Color-image-repeat-attachment-position

Eg:body{background: #ffffff url (' img.png ') No-repeat right Top}

Come down and introduce each attribute feature in order:

Background-color:red, #ffffff; RGB (255,255,255);

Three colors are represented by color name, hexadecimal and RGB, background color can be set for all elements, and transparent by default.

Ii. background-image:url (' img.jpg ')

The image address can be a relative path or an absolute path; The default tile is repeated;

Third, background-repeat:repeat-x;repeat-y;no-repeat;

Default tile repeat display;

Iv. Background-attachment:scroll;fixed;local;inherit;

Background-attachment means whether the background image is fixed or scrolled along with the rest of the page; default scroll;

Scroll refers to the background image that scrolls with the rest of the page, fixed to the invariant, inherit from the parent element, and local scrolling with the scrolling element.

Five, Background-position:bottom center;top;66% 33%;50px 100px;

4 Representations: One is the top,left,bottom,right,center combination; the second is a value, the system defaults to center, the third is the percentage, and the four is the direct write pixel.

The latter two are of high accuracy.

VI. Background-clip:border-box;padding-box;content-box; Specifies the drawing area of the background map.

Seven, Background-origin:border-box;padding-box;content-box; Specifies the location area of the background map.

Note: If the background image background-attachment is "fixed," this property has no effect.

Eight, Background-size:auto (default); Length (two values, one width one high, one value if the default second is auto);p ercentage (The principle of assignment is the same length); Cover (This will maintain the image's aspect ratio and scale the image to a minimum size that will completely cover the background positioning area); contain (at which point the aspect ratio of the image is maintained and the image is scaled to fit the minimum size of the background positioning area);

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.