我在一个项目上使用HTML和CSS工作,我想复制这样的东西在这个网站上使用。
http://slb.com/hse/hse_policy.aspx
在容器div顶部周围的阴影,更重要的是,你如何在阴影上得到一个渐变,使它向底部淡出?我知道如何得到真正的阴影。
干杯
我在一个项目上使用HTML和CSS工作,我想复制这样的东西在这个网站上使用。
http://slb.com/hse/hse_policy.aspx
在容器div顶部周围的阴影,更重要的是,你如何在阴影上得到一个渐变,使它向底部淡出?我知道如何得到真正的阴影。
干杯
3条答案
按热度按时间cwtwac6a1#
没有一种方法可以用纯CSS来做到这一点。您链接的网站使用大图像来执行此操作:http://slb.com/images/gradient_1120.jpg-你需要做类似的事情来获得相同的效果。
qcbq4gxm2#
很明显,他们使用了背景图像(http://slb.com/images/gradient_1120.jpg)。但是你也可以在主体之前添加一些元素(可能是伪元素),并给予它们一个渐变作为背景。
7tofc5zh3#
十多年后,链接的页面404 s,所以我不能确切地知道它看起来像什么,但获得渐变阴影的最佳方法是使用带有轻量级SVG过滤器的伪元素。
这具有跨浏览器工作的优点(支持应该一直回到IE11!),并且不需要任何额外的技巧来处理具有(半)透明背景甚至圆角的元素。