HTML5 Background-color and background-image problem sharing issues

Source: Internet
Author: User

Background and background colors are rendered simultaneously in a label in HTML5.

The general requirement is to specify the background color for the element and then draw the background image in the background color of the product.

Support: GOOGLE,FF,IE9 above browser.

Basic principle: Set the background picture first, and then specify the background color.

Specify the background picture first, background-image:url the background color (http://beijing.gongjuji.net/imgdata/big/ d55ae832-f677-44b8-9419-890f77b849a2.jpg); Background-color: @color;

Or

Specify the background picture first, background:url the background color (http://beijing.gongjuji.net/imgdata/big/ d55ae832-f677-44b8-9419-890f77b849a2.jpg); Background-color: @color;

Note: You do not need to consider the order when using mixed designations.

In mixed use, do not consider order background: @color URL (http://beijing.gongjuji.net/imgdata/big/d55ae832-f677-44b8-9419-890f77b849a2.jpg);

Examples are as follows:

@color: #000000, Body{///// Specify background image, specify background color//Background:URL (http://beijing.gongjuji.net/imgdata/big/d55ae832-f677-44b8-9419-890f77b849a2.jpg);//Background-color:@color;///// Specify background image, specify background color//Background-image:URL (http://beijing.gongjuji.net/imgdata/big/d55ae832-f677-44b8-9419-890f77b849a2.jpg);//Background-color:@color;//In mixed use, do not consider order background:@color URL (http://beijing.gongjuji.net/imgdata/big/d55ae832-f677-44b8-9419-890f77b849a2.jpg);background-size:50% Auto;background-repeat:no-repeat;background-position:Center Center;}. Inner{@color:Red;width:100px;Height:100px;background:@color;}

More:

CSS Page Layout Vertical Center Finishing

CSS3 Flex Layout Finishing (iii)-Project properties

CSS3 Animation Library Collection

HTML5 Background-color and background-image problem sharing issues

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.