简体   繁体   English

使用 css 使图像背景淡入底部

[英]Make the background of image fade to the bottom using css

I have a background image set up on my home page.我在主页上设置了背景图片。

当前背景状态

and for mobile as you see the image has a sharp cut i would like to have a background such as:对于移动设备,如您所见,图像有一个锐利的切口,我希望有一个背景,例如:

预期效果

so that background has a gradient fade till bottom is there a way to achieve this with css or designing and using a background that way is the best option?所以背景有一个渐变淡入淡出到底部有没有办法用 css 或设计和使用这种方式的背景是最好的选择?

Use body or container background (div)使用正文或容器背景 (div)

 #container{ width:100%; height:100vh; background: rgb(252,161,120); background: linear-gradient(0deg, rgba(252,161,120,1) 0%, rgba(247,147,101,1) 30%, rgba(246,123,71,1) 66%, rgba(244,102,42,1) 100%); }
 <div id="container"></div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM