Tips: use CSS to define the webpage background

Source: Internet
Author: User

When we define a background style, we often write this as follows:

The code is as follows: Copy code
Body {
Background: url (img/header_top.gif) left top no-repeat;
}

For example, we want to define a background color and add a color to the background, note that if you want to use the background-color style, do not place the style before the background style:

The code is as follows: Copy code
Body {
Background-color: red;
Background: url (img/header_top.gif) no-repeat left top;
}

The consequence is that there is no background red to show only one picture. I thought it was a BUG and I thought it was the cause. Because the background color in the background style is not defined, it is colorless by default. Because the first line defines the red color and the second line defines the colorless color, the second line is executed.
Pay attention to this problem when defining background in the future.

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.