<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>IE6 PNG Fixes</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=8042119" />
  <subtitle>IE6 PNG Fixes</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=8042119</id>
  <updated>2026-05-08T20:15:17Z</updated>
  <dc:date>2026-05-08T20:15:17Z</dc:date>
  <entry>
    <title>RE: IE6 PNG Fixes</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=8048636" />
    <author>
      <name>Nicola Grigoletti</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=8048636</id>
    <updated>2011-03-29T13:03:36Z</updated>
    <published>2011-03-29T13:03:36Z</published>
    <summary type="html">Hi Gene&lt;br /&gt;&lt;br /&gt;well done! This helps me so much... tks so much &lt;img alt="emoticon" src="@theme_images_path@/emoticons/bashful.gif" &gt;&lt;br /&gt;&lt;br /&gt;Regards, Nicola</summary>
    <dc:creator>Nicola Grigoletti</dc:creator>
    <dc:date>2011-03-29T13:03:36Z</dc:date>
  </entry>
  <entry>
    <title>RE: IE6 PNG Fixes</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=8048490" />
    <author>
      <name>Hitoshi Ozawa</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=8048490</id>
    <updated>2011-03-29T12:46:54Z</updated>
    <published>2011-03-29T12:46:54Z</published>
    <summary type="html">Gene, thanks for the fixes. I was having the same problem with IE6 and PNG. I&amp;#39;ll try out your solution.&lt;img alt="emoticon" src="@theme_images_path@/emoticons/smile.gif" &gt;</summary>
    <dc:creator>Hitoshi Ozawa</dc:creator>
    <dc:date>2011-03-29T12:46:54Z</dc:date>
  </entry>
  <entry>
    <title>IE6 PNG Fixes</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=8042118" />
    <author>
      <name>Gene Surov</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=8042118</id>
    <updated>2011-03-29T07:05:56Z</updated>
    <published>2011-03-29T07:05:56Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi,&lt;br&gt;&lt;br&gt;I'd like to share my IE6 fixes and if possible contribute them into LR.&lt;br&gt;As you know LR6 already has IE PNG fix if you use &amp;lt;img&amp;gt; with src which ends with ".png" or you could force it by applying class png.&lt;br&gt;That's cool, but...&lt;br&gt;&lt;br&gt;1) Background Image&lt;br&gt;In the classic theme there is company logo which is set in CSS as background-image. PNG fix does not work with background images.&lt;br&gt;So I had to make the following modification:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;h1 class="company-title"&amp;gt;
	&amp;lt;a href="$company_url" title="#language(" go-to") $company_name"&amp;gt;
		&amp;lt;img src="$company_logo" alt="$company_name" class="png"&amp;gt;
	&amp;lt;/a&amp;gt;
&amp;lt;/h1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;It does not resolve the problem in general, i.e. there are more elements that have PNGs in background-image, it could be resolved using CSS3 PIE (Progressive IE).&lt;br&gt;&lt;br&gt;2) Input type=image&lt;br&gt;There are some inputs in the classic theme type=image with src=$.png, IE PNG fix does not work for them.&lt;br&gt;In order to fix them I made the following code snippet:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;jQuery(function() {
    jQuery(".ie6 input[src$='.png']").each(function() {
        var bgIMG = jQuery(this).attr('src');
        jQuery(this).css('background', 'none').css('width', jQuery(this).width()).css('height', jQuery(this).height());
        jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\');';
        jQuery(this).attr('src', spacer_image);
    });
});
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;As you might know LR6 comes without jQuery which I'm a big fan of. Thus, to make it working:&lt;br&gt;&lt;br&gt;portal_normal.vm gets these lines in &amp;lt;head&amp;gt;:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;script src="http://code.jquery.com/jquery-1.5.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" charset="utf-8"&amp;gt;
	   jQuery.noConflict();
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;and init_custom.vm:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;script type="text/javascript" charset="utf-8"&amp;gt;
    var spacer_image = "$spacer_image";
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;3) And last but the most time consuming thing I've done is CSS sprite with PNG fix. I didn't find any library which could solve this problem easily. In addition the icons that use CSS sprites have src=spacer.png so I had to treat them in a special way.&lt;br&gt;&lt;br&gt;Here's what I did:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;jQuery(function() {
    /** CSS sprites png fix */
    var sprites = [
        ['.aui-icon-home', 112, 0],
        ['.aui-icon-clock', 112, 80],
        ['.aui-icon-person', 144, 96],
        ['.aui-icon-document', 96, 32],
        ['.aui-icon-document-b', 96, 48]
    ];
    for (var i = 0; i &amp;amp;lt; sprites.length; i++) {
        var els = jQuery(".ie6 img" + sprites[i][0] + "[src$='spacer.png']");
        els.each(function() {
            var 
                el = jQuery(this),
                bgIMG = el.css('background-image').replace('url("','').replace('")',''),
                width = el.width(),
                height = el.height(),
                top = sprites[i][1],
                left = sprites[i][2],
                margin = 3;
            var sprite = new Image();
            sprite.src = bgIMG;
            var container = jQuery('&amp;lt;div class="sprite-icon-container"&amp;gt;&amp;lt;/div&amp;gt;').width(width).height(height);
            el.wrap(container);
            el
                .css('position', 'absolute')
                .css('background', 'none')
                .css('background-position', 'top left')
                .css('width', sprite.width).css('height', sprite.height)
                .css('top', -top+margin).css('left', -left-margin)
                .css('clip', 'rect(' + top + 'px,' + (left + width) + 'px,' + (top + height) + ' px, ' + left + 'px)');
            el.parent().css('position', 'relative');
            el.get(0).runtimeStyle.filter = 
                'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\',sizingMethod=\'scale\');';
        });
    }
});
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;So basically it uses clip CSS property with absolute positioning instead of background-position.&lt;br&gt;As you can see I had to define an array of the css classes of icons I want to fix together with the top and left coordinates in the sprite. &lt;br&gt;&lt;br&gt;I hope it makes sense for you and if it helps to make LR better I would be happy &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif"&gt;&lt;br&gt;&lt;br&gt;-Gene&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Gene Surov</dc:creator>
    <dc:date>2011-03-29T07:05:56Z</dc:date>
  </entry>
</feed>
