我需要一個背景圖像背景圖像底部梯度CSS3
我想不通的底部,這種類型的梯度 - 如何我可以用CSS這種類型的梯度。我上傳了我的代碼jsFiddle。
.single-blog-bg {
background-size: cover;
background-attachment: fixed;
height: 350px;
position: relative;
}
.single-blog-bg:before {
content: '';
position: absolute;
left: 0;
right: 0;
top: 300px;
bottom: 0;
background: linear-gradient(to bottom, white 10%, white 30%, white 60%, white 100%);
opacity: .5;
}
<div class="single-blog-bg" style="background-image: url(https://i.stack.imgur.com/VT8SR.jpg)"></div>
這裏顯示白色梯度,但不喜歡我的期望。
有沒有人會幫我得到確切的CSS代碼?
的JS小提琴鏈路https://jsfiddle.net/sLhf9on0/2/ –
codepen鏈路https://codepen.io/djmayank/pen/vJyoVe – djmayank
兩者梯度和圖像可以一起設置。首先是漸變,然後是圖片。 https://jsfiddle.net/sLhf9on0/5/ –