Posts Tagged ‘internet explorer’

The utterly retarded IE PNG implementation (and pngstrip)

Tuesday, August 12th, 2008

pngstrip (32bit, Windows Executable at 59 kb) is a small program I’ve written to strip out the various kinds of gamma and chromacity information from PNG files. It’s written in standard ANSI C, so should compile on anything reasonable, though it has only been tested on Windows XP. The source code is also freely available. It’s console program, just type out pngstrip filename.png, and filename.png will be stripped.

We spent years agonizing over the lack of 8-bit alpha channel in PNG in IE, and when we filly get it natively/nicely supported in IE they go and botch is so horribly.

Most of us have heard about gamma. But unless you do something in the graphics/print field, it mostly remains a button on our screen, where we tweak the luminocity of the screen. But of course, when an artist makes a snazzy PNG picture, making sure that it appears at the same display intensity as it did on his screen is understandably an laudarble goal. So PNG embeds gamma information, saying that this and that color, should be show at this and that intensity. The problem occurs when the BOG STANDARD (for 15 years and counting) HTML and CSS colors are NOT processed through the same system and thus don’t get the same gamma correction applied. The problem is easy to spot (need to be viewed in IE). The PNG files, once stripped, appears correctly.

I won’t really bother explaining this problem more, since it goes beyond stupid, I’ll just link further reading materials if you don’t know why you may wish to strip your PNG files for gamma information. Henri Sivonen has the best treatment on the topic.

IE formatting oddity

Sunday, July 6th, 2008

It’s good to know that within 1 day of returning to any amount of CSS work, Internet Explorer can still baffle me. Maybe I’m missing something here, but seems that if a small tag (yes, let the damnations begin, but it was mostly due to the WordPress default template using it, that I came across it) does not include some trailing whitespace, it receives a little extra padding.

Small element rendering comparison
Rendering oddity with small tags with no trailing whitespace.

The HTML code used validates, should you wish to inspect it yourself. The “CSS1Compat” mode is merely to ensure we’re in “standards mode”.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head><title>wth ie</title>
<style type="text/css">
h2{
background-color:red;
margin-bottom:0;}

.wth {
background-color:green;
margin-top:0;}
</style>
</head>
<body>

<h2>foo</h2>    <small class="wth"> b ar </small>

<h2>foo</h2>    <small class="wth"> b az</small>

<hr/>
<script type="text/javascript">
document.write(document.compatMode);
</script>

</body>
</html>

You’ll notice I remove all margin on the elements. And indeed, the first header h2 and small does render correctly. But the second gets a 2 pixel margin added for … who knows what reason.

Reflections on max-width

Saturday, July 5th, 2008

A couple of years ago, I added a page to my old site on an “easy” fix for emulating max-width behavior in Internet Explorer, by utilizing a powerful IE5 feature called dynamix properties/expressions.

Briefly, these expressions allow a web author to hook script expressions into the dynamic nature of HTML elements. The natural events of the page (onresize, onclick, onmouseover and so on) causing these expressions to be re-evaluated whenever content could possibly reflow. The effect is naturally very powerful.

(more…)