How to use CSS to achieve large background page effect

Source: Internet
Author: User

In the design of Web pages, you often encounter the problem: When using a picture background, because the display resolution is too large or the picture size is too small, on either side of the page or the lower part of the background picture. For example: There is no problem when the resolution is less than 1024*768. But if your monitor has a resolution greater than 1024*768, you will see a part of the background image that affects the effect. The following figure:

How to use CSS to achieve a large background of the Web page effect, below to see some examples:

Example 1: Picture + background Color

Sets the color of the edge of the picture to the same color as the background color of the page. Look at the picture below, note that the edge of the picture is solid color.

This section is simple, set the background image for the BODY element (located in Center,top)

Here is the CSS code:

CSS code copy content to clipboard

The code is as follows:

Body {

padding:0;

margin:0;

Background: #f8f7e5 URL (wdw-bg.jpg) no-repeat Center top;

width:100%;

display:table;

}

Example 2: Two pictures

A repeating soft plank pattern is applied to the body tag, and a centered background pattern is applied to the wrapper label.

The trick here is to use a similar but darker color for the GIF image as the cork background.

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.