所有主要浏览器上的 css 不可见(透明)字体颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20048225/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Invisible (transparent) font color with css on all major browsers
提问by Sarfaraz Alam
Is it possible to make the font (font-color) transparent while using any color like black or white? Just have the font slowly disappear, like display:none
. Thanks
是否可以在使用黑色或白色等任何颜色时使字体(字体颜色)透明?只是让字体慢慢消失,比如display:none
。谢谢
回答by Aida_Aida
You can use css property
您可以使用 css 属性
opacity: 0;
and you will not be able to select the text,
并且您将无法选择文本,
or
或者
color: transparent;
and you will have the chance to select the text.
您将有机会选择文本。
If you want to make this slowly look at jQuery functions .fadeOut()
http://api.jquery.com/fadeOut/or .animate()
http://api.jquery.com/animate/
如果你想慢慢看 jQuery 函数.fadeOut()
http://api.jquery.com/fadeOut/或.animate()
http://api.jquery.com/animate/
回答by SW4
You can use RGBA colors, where the last level is alpha (transparency), e.g.:
您可以使用 RGBA 颜色,其中最后一个级别是 alpha(透明度),例如:
color:rgba(255,0,0,0.3);
color:rgba(255,0,0,0.3);
Which is red at 30% opacity. RGBA values are supported by IE9+, Firefox 3+, Chrome, Safari, and in Opera 10+.
不透明度为 30% 时为红色。RGBA 值受 IE9+、Firefox 3+、Chrome、Safari 和 Opera 10+ 支持。
You also have HSLA, e.g.:
你也有HSLA,例如:
color: hsla(0,100%,50%,0.6);
color: hsla(0,100%,50%,0.6);
Again, the last value, alpha, sets the transparency
同样,最后一个值 alpha 设置透明度