查看完整版本: [求助]想將background fix 到岩岩好要點做?

kinskyjb 2009-11-11 01:10 PM

[求助]想將background fix 到岩岩好要點做?

[求助]想將background fix 到岩岩好要點做?
如題,如果我有一幅好大既圖,想將佢放係background到...但係我就咁放,佢會有某d部分睇唔哂...(因為太大張),咁唔知點先可以將佢fix到岩岩好...唔會幅圖做background但睇唔哂?
另外,如果相反幅圖太細,點先會自動放大到岩岩好?

我係新手,希望大家唔好介意~thz

superrice 2011-5-19 06:53 PM

CSS3:

body {
        font-size:50%;
        background: url(../images/bg.jpg) no-repeat center center fixed;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
        background-size: cover;
       
}

img#bg {
        /* Set rules to fill background */
        min-height: 100%;
        min-width: 1100px;

        /* Set up proportionate scaling */
        width: 100%;
        height: auto;

        /* Set up positioning */
        position: fixed;
        top: 0;
        left: 0;
}
@media screen and (max-width: 1024px) { /* Specific to this particular image */
        img#bg {
                left: 50%;
                margin-left: -512px;   /* 50% */
        }
}
頁: [1]
查看完整版本: [求助]想將background fix 到岩岩好要點做?