[英]In CSS background-image with radial-gradient of dotted circle, is it possible to hide the dots at the edges?
[英]Radial-Gradient Circle Overlay on Background Image
我正在嘗試在CSS中的背景圖片頂部應用尺寸為徑向漸變的圓。 每當我應用漸變線時,它都不會執行任何操作-我的圖層似乎混亂了。
/* HTML Styles */
html {
background-image: url("image1.jpg");
background-attachment: fixed;
}
/* Body Styles */
body {
background-image: url("image2.jpg");
background: radial-gradient(circle closest-corner at 40% 70%, white 15%,
rgba(151, 151, 151, 0.5) 50%);
}
您需要將它們附加在與您要覆蓋第一個background-image
代碼相同的背景屬性中,並且僅考慮漸變。 另外,請確保您尊重順序, 第一個是頂層 。
body { margin:0; height:100vh; background: radial-gradient(circle closest-corner at 40% 70%, white 15%, rgba(151, 151, 151, 0.5) 50%), url("https://lorempixel.com/400/200/") center/cover; }
您也可以使用這種語法(上面的是簡寫形式) :
body { margin:0; height: 100vh; background-image: radial-gradient(circle closest-corner at 40% 70%, white 15%, rgba(151, 151, 151, 0.5) 50%), url("https://lorempixel.com/400/200/"); background-size: auto, cover; background-position:center; }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.