简体   繁体   中英

Non-English IE9 and CSS opacity

Look at the HTML code below:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
        <div style="opacity:0.5">Hello World</div>
    </body>
</html>

On English IE9 things go as expected and the "Hello World" div is shown with the desired (50%) opacity, but on German IE9 the div is hidden and by reviewing the DOM in the "F12 developer tools" I can see that the opacity evaluates to 0 instead of 0.5. Moreover after assigning any other value with a fractional part to the opacity property causes the latter to evaluate to the integer part only ignoring the fractional part (ie opacity:22.34 evaluates to 22). Any idea what can be the difference between the English IE9 and the German IE9 causing this strange CSS behavior and how can I work around it (IMPORTANT: I don't want to use the alternative properties like filter:alpha or -ms-filter etc.)?

Very strange behaviour :S

The only idea I can think is about the decimal mark used in German and in English. In english it's a dot ( 0.5 ) and in german is a comma ( 0,5 ). You can try to put the comma to see what it happens. But if this is the problem, it's very very strange, because I suppose the notation depends on the CSS specification and not from the decimal mark used in each country. And I suppose as well that both IE share same core and there is only a L10n (localization) change.

Or look if both IE are exactly the same version (not only 9, but 9.whatever). Maybe is a bug in some version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM