使用background-imageonbody標簽和div其中的two 。我需要為每個都有模糊的背景 div。我現在能做的就是對background-image每個進行設置div并使用filter: blur屬性來模糊它們。但因為我希望整個頁面具有相同的背景(不為每個頁面分開div),所以我希望它的方式是在標簽background-image 上設置body,然后模糊div元素。這就是我嘗試過的:body { background-image: url(public/images/billy-huynh-W8KTS-mhFUE-unsplash\ \(1\).jpg); background-attachment: fixed; background-size: cover; display: grid; align-items: center; justify-content: center; height: 100vh; width: 100vw; position: relative;}.parent-div::before { content: ""; display: block; position: absolute; top: 0; bottom: 0; right: 0; left: 0; width: 100%; height: 100%; filter: blur(5px);}.parent-div { position: relative;}HTML 代碼:<body><div class=" parent-div"> <div class=" child-div"> <h4 class=" text-light">Hello world!!</h4> </div></div><div class=" parent-div"> <div class=" child-div"> <h4 class=" text-light">Hello world!!</h4> </div></div>事實上,我想模糊div沒有背景圖像的元素。有辦法這樣做嗎?謝謝
- 0 回答
- 0 關注
- 130 瀏覽
添加回答
舉報
0/150
提交
取消