"CSS" full screen large background

Source: Internet
Author: User

1. Use the div hierarchy, set the underlying div to fill the screen, and set the background map for the Div

<div id= "Layer1" style= "position:absolute;top:0;width:100%; height:100%; Z-index:-1 ">

</div>

2. Using the BODY element

Body{background:url No-repeate Center position red; Background-size:cover};

Body{background:url No-repeate Center position red; Background-size:contain};

Background-size:cover background picture fills the entire container, regardless of whether you see the full picture

Background-size:contain background picture fills the entire container and appears full picture

background-size:200px 100px; Numeric representation

background-size:30% 60%; Percent representation

Background-size:auto; Fills the element with the size of the picture itself, that is, the auto value

3. js get the screen width high, set the IMG width high

4. Using Filters

body{
Filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src= '/skin/v2011/images/body.png ', sizingmethod= ' Scale ');
Background-repeat:no-repeat;
background-positon:100%, 100%;
}

5. Picture automatically adapts to browser size-pending verification

Img.source-image {
width:100%;
Position:absolute;
top:0;
left:0;
}

http://liyunpeng.iteye.com/blog/2101956

"CSS" full screen large background

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.