Home  >  Article  >  Web Front-end  >  让IE支持RGBa的背景色的代码_javascript技巧

让IE支持RGBa的背景色的代码_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:23:241200browse

上代码:


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

DXImageTransform.Microsoft.gradient滤镜里的startColorstr参数值是#AARRGGBB形式的,其中的AA是代表不透明度的十六进制,00表示完全透明,FF就是全不透明,化成十进制的范围就是0~255,剩下的RRGGBB就是颜色的十六进制代码。例子中background: rgba(125, 0, 0, .3);表示的是30%不透明度的红色背景。如何把30%的不透明度转换成十六制呢?很简单,先计算#AA的的十进制x,x/255 = 3/10,解得x=3*255/10,然后再把x换算成十六进制,约等于4B。

下面附上示例中用到的图片:
让IE支持RGBa的背景色的代码_javascript技巧
作者:周明智
文章部分内容来自:RGBa Browser Support

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn