RGBa in Internet Explorer

↘锁芯ラ 提交于 2019-12-06 05:37:04

问题


I know that IE does not support RGBa. I also know that you can use the follow methods:

/* For IE 5.5 - 7*/
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
/* For IE 8*/
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";

The first two Numbers in the "Colorstr" is the value for the opacity. with 99 being a .6 opacity. For other levels of opacity what are the number values? I cannot find them. Is there a simple way to calculate the number for opacity? Or where can I find those values?

Thanks =>


回答1:


Looks like it's straight 1-byte hexadecimal, so just do this

Say your opacity is 30%:

.30 * 255 = 76.5
76 -> hex = 4C

You can convert decimal to hex using a variety of desktop tools, online pages, or this JS function:

new Number(76).toString(16);



回答2:


It's a hexidecimal 99 which is 153 in decimal. type 0x99 in a js console and it will spit out 153. F is the highest digit in hex so typing in 0xff (the highest value for two hex digits) will give you 255. if 255 is 100% and 153 is the value you want to know the percentage of you divide 153 by 255 which results in 0.6.




回答3:


sure, use a hex to percentage converter like this:

#999999 converts to rgb(60%, 60%, 60%) so 99 = 60%

#BABABA converts to rgb(73%, 73%, 73%) so BA = 73%

you can probably find a better hex converter than the one I've suggested. Remember that hex is base 16, not 10...




回答4:


As of March 2011, Internet Explorer 9+ DOES process rgba correctly, and, in fact, does so more accurately/thoroughly than [Chrome|Mozilla|Safari]...



来源:https://stackoverflow.com/questions/6935772/rgba-in-internet-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!