iT邦幫忙

0

想問一下為甚麼我的第二張以後的Background-image都這麼小一張

Yes
我有試著使用 background-size:cover;但是他的畫質直接爛掉:)
照片是1200*960

CSS

        .body1{
            width: 100%;
            height: 960px;
            position: relative;
            background-image: url("img/background.jpg");
            background-attachment: fixed; /* 固定圖像 */
            background-repeat: no-repeat;
            background-position: center center;
            z-index: -9999;
        }
        .body2{
            width: 100%;
            height: 500px;
            background-color: #fff;
            box-shadow: 10px 10px 100px hsla(240, 40%, 15%);
            position: relative;
            right: 0;
            top: 0;
        }
        .body3{
            width: 100%;
            height: 1000px;
            position: absolute;
            background-image: url("img/background-1.jpg");
            background-attachment: fixed; /* 固定圖像 */
            background-repeat: no-repeat;
            background-position: center center;
            z-index: -9999;
        }

HTML

    <div class="body1"></div>
    <div class="body2">
        <div class="body3">

        </div>
    </div>

再麻煩各位大大幫我解惑了QQ

Mao iT邦新手 1 級 ‧ 2021-11-12 23:04:32 檢舉
  
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
Mao
iT邦新手 1 級 ‧ 2021-10-09 14:43:40

我覺得還是你圖片大小的問題
我自己試,同樣 1200 寬度 的圖片效果顯示正常
Codepen 展示

ShawnGood iT邦新手 5 級 ‧ 2021-10-11 00:53:15 檢舉

研究了一下 終於搞懂為什麼css要這麼寫了
學到拉門效果了 感謝倆位 ?

我把我自己整理過的也放上來
https://xwc2021.github.io/mypage/css-practice/window_scroll.html

我要發表回答

立即登入回答