CSS background related properties in detail

Source: Internet
Author: User
The impression that the CSS controls the background is just a background, but background is a composite property

It includes:

    • Background-color: Background color, CSS support color representation method, can be used

    • Background-image: Background image (URL)

    • Background-repeat: Whether the background is duplicated (Repeat, no-repeat, repeat-x, repeat-y)

    • Background-position: Background positioning (keywords, percentages, pixels)

    • Background-size: Background size

    • Background-origin: Positioning area of the background

    • Background-clip: Background Paint area

    • Background-attachment: Specifies whether the background image is fixed or scrolls along with the rest of the page

In addition to these, multi-backgrounds, gradients, masks, I also put them in the background.

Take a look at it -0-.

At the beginning, I thought for a long time that the background was a background of the word. Because I always write:

. p{background: #000 URL ("1.jpg") No-repeat left center;/* color, picture, tiling, positioning */}

I don't know if people write like me. Very simple, background color, background image, whether to repeat, positioning 4 properties attached to write.

Here are the other properties.

Location area of the background (Background-origin): The value is a keyword, there are 3

. div{        width:400px;        height:200px;        padding:20px;        border:10px solid Rgba (255,255,255,.2);        Background: #000 URL ("1.jpg") no-repeat;        Background-origin:border-box;        /*background-origin:padding-box;*/        /*background-origin:content-box;*/    }
    • Border-box

    • Padding-box

    • Content-box

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.