热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用CSS3渐变alpha淡出效果-GradientalphafadeouteffectwithCSS3

IwouldliketoknowifitwouldbepossibletoreplicatetheeffectlikethebottomoftheTopTwee

I would like to know if it would be possible to replicate the effect like the bottom of the Top Tweets list with pure CSS?

我想知道是否可以使用纯CSS复制顶级推文列表底部的效果?

http://www.twitter.com

2 个解决方案

#1


20  

Yes you can! Taking advantage of RGBa colors and CSS3 gradients, we can apply the following styles to an element and have a fading semi-transparent background:

是的你可以!利用RGBa颜色和CSS3渐变,我们可以将以下样式应用于元素并具有淡化的半透明背景:

Mozilla:

background: -moz-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255, 1));

Webkit:

background: -webkit-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255, 1));

(Updated after changes to Webkit gradients)

(更改Webkit渐变后更新)

Sadly, this only works in Firefox 3.6+, Safari, and Chrome. If you need the effect in IE or older versions of Firefox, then you'd be better off using the semi-transparent PNG like Twitter does.

遗憾的是,这仅适用于Firefox 3.6 +,Safari和Chrome。如果您需要在IE或旧版本的Firefox中使用效果,那么您最好使用像Twitter这样的半透明PNG。

#2


1  

Although this is not an all-around sollution, it works on Safari/Webkit - so it's nice to know for someone who does mobile apps.

虽然这不是一个全面的解决方案,但它适用于Safari / Webkit - 所以很高兴知道那些做移动应用程序的人。

So, suppose you only address webkit, you've got this nice feature described here.

所以,假设你只解决了webkit问题,你可以在这里描述这个很好的功能。

-webkit-mask-image: -webkit-gradient(...)

This also helps you when you can't fake the fade-out with some overlaid element. (for example, having an image on the background, instead of a solid color)

当你无法用一些重叠的元素伪造淡出时,这也可以帮到你。 (例如,在背景上有图像,而不是纯色)

For the rest, go with the above.

其余的,请按照上面的说法进行操作。


推荐阅读
author-avatar
热血洒在青春中
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有