Monday, June 9, 2008

Links don't work in IE6 while filter:progid:DXImageTransform.Microsoft.AlphaImageLoader is set

THE PROBLEM
All of the link within a div which has css property

filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.png', sizingMethod='scale');

set seems inactive in Internet Explorer 6. If you simply comment this property, IE6 will give you back the usual rendering.



THE SOLUTION
This problem seems quite hard to be solved, and many articles has benn written about it, but as a matter of fact the simplest css hack is all you need to fix it: you simply need to declare

position:relative;

in a pseduo-class selector to get all of your contents work properly!



A WORKING CODE EXAMPLE
<html>
  <head>
    <style>

      a, a:visited, a:hover, a:visited:hover
      {
        text-decoration:none;
        color:#848484;
        position:relative;
      }

      #wrapper
      {
        filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.png', sizingMethod='scale');
      }

    </style>
  </head>
  <body>
    <div id="wrapper">
      <a href="#"></a>
    </div>
  </body>
</html>

Monday, December 10, 2007

ERRORS COMPILING STELLARIUM 0.90 SOURCES IN UBUNTU

AN UNUSEFUL INTRODUCTION
You could notice lots of errors while trying to compile Stellarium from source in version 0.90. In particular, this are very common errors in Ubuntu 7.04 Feisty Fawn, but should be not less common for other Ubuntu version.



HOW TO INSTALL STELLARIUM FROM SOURCE
When you compile stellarium 0.90 you are supposed to do the following:

Unpack sources
~$ tar -xzf stellarium-0.9.0.tar.gz

Enter the unpacked sources folder
~$ cd stellarium-0.9.0

Compile the sources
~$ cmake .
~$ make

Fully install the software
~$ sudo make install

Clean the build directory (not mandatory)
~$ make clean



QUITE COMMON ERRORS YOU MAY RECEIVE FROM THE TERMINAL...
From the terminal you may get outputs like these:

Case 1.
cmake: command not found

Case 2.
Qt qmake not found

Case 3.
boost was not found



... AND THEIR SOLUTIONS
But never mind: the solution is pretty easy!

Case 1.
~$ sudo apt-get install cmake

Case 2.
~$ sudo apt-get install libqt4-dev qt4-dev-tools

Case 3.
~$ sudo apt-get install libboost-dev

Thursday, December 6, 2007

PNG FIX FOR XHTML DIV'S BACKGROUND

AN UNUSEFUL INTRODUCTION
Many word have been written over the problem of the *.png's transparency visualization in IE<7 versions. Now I'll drop some lines too. In particular, I found it interesting to try to fix this problem when you need to put transparent images in some DIV's background.



THE PROBLEM NOWADAYS The most well-known method to solve the similar problem with the *.png's transparency in the IMG tag is to use the javscript published here. It is a quite simple script, which simply searches for all of the IMG tags with an ID assigned, get their SRC property, and add a particular STYLE attribute.



A DIFFERENT POINT OF VIEW
To let IE previous than the 7 version display *.png's with transparency correctly, this script simply adds one non-standard line to your CSS definitions. This is it.

filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.png', sizingMethod='scale');

This is a non-standard patch to the CSS 2.1, created by Microsoft for their browsers only. You can check out the official documentation in the MS KB294714.

What I am about to propose is a different approach to the problem, completely dedicated to the DIV tag, with no javascript usage at all. But, how is it possible to distinguish browsers without server-side or client-side scripts?



THE PROBLEM OF DISTINGUISHING BROWSERS
Obviously, it is not a solution to simply use both the MS special CSS property and the standard

background:url('image.png');

attribute, because the second one will be red even by MSIE, vanishing what previously done. But never mind! There is almost one easy trick to solve this problem.



THE SOLUTION
Probably the easiest way is to simply modifify your style sheet and add the standard and the MS proprietary attributes to the CSS in two separated selectors. Only one of them should be understood by MSIE. To be more clear, let me give you an example:

/* this will be understood by all of the browsers */
.menu_holder
{
width:20px;
height:80px;
background-position:center;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.png', sizingMethod='scale');
}

/* this will be understood by all of the non-IE browsers */
html > body .menu_holder
{
background:url("image.png");
}

To be honest I prefer to use a PHP style sheet parser and the NET_USERAGENT_DETECT PEAR class, but I am a quite strange person...

Doing what's explained in this page should solve all of your div's background trasparency troubles in Internet Explorer.

Wednesday, December 5, 2007

Hello folks! This is my first post. I'll write posts for this blog only when I'll find out something interesting to be written.
Obviously, this is just the Nth disgusting computer blog, but I hope some of my writings will help someone.
C U!