Lessons learned in dealing with IE 6

I’ve been “battling” with IE for more than 3 years now and I just felt that it’s finally time to not only bash the poor beloved browser and instead pay homage to the good things that it was able to instill on me.

There is no such thing as one tweak fix all

If there’s such a thing, the guy (or girl) who was able to find that tweak would’ve been a bajillionaire by now. That or he/she’s, unfortunately probably a Microsoft employee by now.

Patience is a virtue (and a very important skill)

There was a time before when I was able to “fix” a specific IE bug in one of my dreams. I can’t remember what that bug was though, but I’m sure that happened, because that also happened when I was trying to play with WordPress before.

Anyway, I think IE is a great therapy for people who need to manage their angers. I used to be very explosive when I’m angry or when I can’t find a solution to a problematic rendering error. Sure, you can say that I matured a little but I think that if IE’s following my every whim all the time, then I don’t think I would be used to seeing any design screwed up in the blasted beloved browser.

If it fixed your problem…

Chances are that it opened a LOT of seemingly unrelated problems waiting to be discovered. I fixed a height problem and the next thing I know, the other elements (who are important at that!) are not showing up anymore. So be wary, be very, very wary about that hacks and fixes.

With IE, anything is possible

I honestly have a feeling that the Murphy’s Law was created with IE in mind, no kidding! If you think that there’s no way that any element will collapse specially if you already specified its width and height, then expect IE to crush that belief of yours.

If you’re dealing with IE, it’s OK to be paranoid

And check, and check, and check. There was a time when an office mate and I was checking the same site in IE, just different machines and it’s rendering differently. Seriously.

If your element collapsed in IE, chances are that it doesn’t have a haslayout

And that usually means you need to add a height and width to your element and if that still did not work, add an overflow:hidden. Sometimes that still won’t work so you have to add a display:block. That usually does the trick. If you don’t want to add a specific height however, you can add 1% or 100% as its value, anything as long as it’s not auto or a pixel or em. Be careful though, if you add a height to its parent div, it’ll take the height of its parent.

I could never stress this enough — haslayout is everything in IE

If your element is inline, then it’s fine, but if it’s a block-level element we’re talking about, grab the IE dev toolbar and hunt for that ever-elusive haslayout property.

Sidenote: Want to run 2 IE in the same machine? Download IE 6 and then download a copy of IE 7 standalone, yes, it’s necessary that it’s in that order and not the other way around because last time I had IE 7 as my default browser and got the IE 6 standalone, IE dev toolbar no longer worked which is one of the things that enabled me to keep my sanity back then.

Before using an IE hack, check out if you can solve the problem without it.

Yes, even if it drives you insane. It’s daunting, it’s scary, but it’s to be done. I hate to look at an IE6 specific stylesheet that contains more or less 100 lines of code. If it’s a problem with margins, try to see if the changes you need to do will make such a big impact to the other browsers, if it’s hardly noticeable then apply the fix in your main stylesheet. Now if we’re talking about 20-25 pixels (or more) difference then by all means, do it in a separate stylesheet.

IE6 doesn’t want <tr> to have borders

It’s annoying when I realized that. I thought the problem was that the table doesn’t have haslayout (how can a table not have a haslayout when it’s a block-level element by default, yes?!) that’s why the borders won’t show up. Turns out that IE doesn’t render a border when it’s in the <tr> tag, you have to add the border in the <td> tag and don’t forget to add border-collapse:collapse for your table so that the border will look continuous.

Test again and again and again

I told this to you before, remember? You can never be too sure with IE so you must be paranoid. You must be an OC and you must never forget to expect the worst case scenarios.

So there! What IE taught me so far, anyone else want to throw in some ideas too?

One unrelated musing, do you know that I just finally realized that this sign < stands for less than and > stands for greater than. It’s stupid, I know but it’s true! And guess what finally taught me this very “complicated” mathematical symbol.


The less than (<) sign’s equivalent (just in case you didn’t know) is & lt; and the greater than (>) sign’s equivalent is & gt;. Finally, it’s out of my system.

Appending the title of the post in “Read more” links for WordPress

One of the guidelines in usability is that you should provide only one way that will lead them to a certain action. For example, if someone sees 2 option buttons, chances are that they might think that each option button does separate tasks when in fact their functions are the same. Also, we have to make sure that the links are descriptive enough and if not, then we should provide a title for the link so when a user hovers over it then they’ll know where the link will take them.

On a similar note, accessibility advocates encourages people to use unique name for every link that we use on a page (kinda like what I was saying before only have a different reason), meaning countless “Read more of this entry” is not really the best practice because you’re using the same text over and over and these texts are leading the user to different pages.

I was looking for a way to add that in <?php the_content(); ?> tag in wordpress before but I couldn’t do it. What I did then was append the the_title(); within the_content(); so it looked like this —

<?php the_content('Read more of ' . the_title() . ' & raquo;' ?>

The problem though is that it does echo the “Read more of” but the title is no where in sight! I was so ready to find a way to make it show by hacking away through function.php, thankfully I remembered to check the_content page in the codex first.

What I should’ve done in the first place is to add parameters to the the_title() tag so it will show like this —

<?php the_content('Read more of ' . the_title('', '', false)) ?>

This follows the same parameter as the the_title(); template tag.


(string) Text to place before the title. Defaults to ”.

(string) Text to place after the title. Defaults to ”.

(Boolean) Display the title (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.

So you may use it like this:

<?php the_content('Read more of ' . the_title('&ldquo ;', '&rdquo ; » ;', false)) ?>

So it will echo as Read more of “Title of the Post” ».

The great IE 6 Hack

As a designer, the biggest problems that I have with IE are the PNG transparency problem and the :hover pseudo class is not working unless it’s used in the a element.

Thanks for HTC which is only understood by IE 5.5 and above browsers — I’ve found some handy “hacks” to work around these 2 limitations on the browser designers/programmers’ love to hate.

Note: calling it in CSS will make your CSS file invalid even though it’s a part of CSS property lists, I tested it against CSS 1, 2, 2.1 and 3 (just to be sure) so… CSS valid-freaks sorry… Maybe it remained to be just a part of the draft?

PNG Transparency

I have to admit that I haven’t really looked that hard for PNG transparency hacks, sure you can use PNG 8 but, isn’t it just a “PNGized” GIF? Anyway, if you’re certain that you won’t be using your image on plain backgrounds and your background does not have patterns on them then PNG 8 will be a good solution.

So, while I was looking for a hack to make PNG work on IE 6, I came across IE PNG Fix of Twinhelix which is a good enough solution for me because it doesn’t complicate things for me and it also works on PNG backgrounds on CSS and images you have to insert into your HTML file. However, this being a “hack”, of course it has some limitations too.

The list is from the author, the ones that with emphasis are mine.

  • Can’t help IE versions prior to 5.5, sorry.
  • Users can’t right-click-save processed PNG images, they’ll save the blank GIF file if they try that. In some cases this might be a feature, not a bug…
  • The script detects the “.png” extension in image URLs. So if you have a CGI script that generates a PNG image, you may have to rewrite parts of the script, or just cache them as PNG files somewhere. Apparently, this is also an issue in RoR, I really don’t know why but the images will still not be transparent unless you specifically call the image using the <img> tag, so say goodbye to your <%= image_tag("path_to_file_here") %> way of calling images (unless it’s a JPG or GIF of course).
  • It’s most reliable on elements with non-‘auto’ dimensions set. So, give images and other elements width/height values; ‘100%’, ’10em’ and ‘200px’ and so on are all OK, otherwise, you will have a heart attack once you’ve seen it in IE, it’s transparent, yes but still, it is not pretty.
  • Background PNG images can’t be tiled. This is a limitation of the IE filter.
  • Similarly, padding and borders don’t indent the PNG image. An easy fix for this is wrapping your PNG images in container DIVs or similar.
  • There may be about a short time as soon as the image loads when images are not transparent, before the IE filter kicks in.

For it to work, all you have to do is create a blank transparent GIF file (it doesn’t matter what size it is) put the path to it in the htc file and call the htc by adding

* { behavior: url(/path_to/iepngfix.htc) }

anywhere in your CSS file. Note that you can replace * with img or whatever element you want. Then voila! PNG transparency has been achieved.

Applying :hover pseudo class for whatever element in IE 6

As I’ve said before, another shortcoming of IE 6 is that it only applies the :hover pseudo class on the a element so it’s really hard to create a hover state for menu items using the sliding door technique unless all you have to do is change the menu item’s link color. Unless you love cutting images for specific menu items or your item’s width is fixed and don’t care what it’ll look like once you have increased the font size, then I guess you need not worry about it.

Anyway, this time, I need not look so hard because of whatever:hover yey! All you have to do is put the htc file anywhere in your site, call it in your CSS using the behavior property again like so —

* { behavior: url(/path_to/csshover.htc) }

(again you can change * to whatever element you want) and voila! You can apply the :hover pseudo class to whatever element that you want and you can be absolutely certain that it will be reflected in IE 6. Lovely. :)

Is there a hack for IE 6 that you know? Please do share. :)

Update (April 28, 2008): Joni buzzed me earlier to ask if maybe adding the behavior property in a stylesheet that’s meant only for IE will make your stylesheet valid. I tried it at Last Leaf and it did! So… now you can make your site valid even though you’re using htc. I can’t believe I failed to test that when I’ve been using IE conditionals for more than a year already! hehe Credit to Joni Ang, XHTML/CSS/Wordpress theme designer extraordinaire :) Also, if you’re using wordpress and you added htc within your theme’s folder, don’t forget to add the complete path to your blank.gif and htc, otherwise, it won’t work.

The Basics of Accessibility

It makes me feel a little sad whenever I see people saying that making your website accessible is such a waste of time and resources because it only deals with the blind. When, in fact, that is one of the misconceptions about accessibility.

What is Accessibility?

Just look for its root word — access. It doesn’t only mean that blinds and other visually-impaired people should be your focus when it comes to making your site accessible. It means making every people using any kind of browsers, any kind of devices to browse the web, any kind of settings on their browsers, no matter how slow or fast their connection is must be able to view your site just fine.

Accessibility to what we have here given portable plasma cutter reviews is not only making your site well-structured that those using screen readers won’t be exasperated in using your site but also making your site accessible to:

  • people who have problems with their visions because they are suffering from color blindness and other stuff related to it, or because of old age — the most popular
  • people using lynx or other text only browsers
  • people who don’t use mice because they are suffering from locomotive disorders
  • people who have turned off images to save loading time
  • people who have turned css off
  • people who are using PDA, their mobile phones, iPhone, iPod, PSP, etc
  • people who are using their TVs for screen
  • people who are using browsers older than I am
  • people who are on dial up
  • people who have a connection slower than a dial up
  • people who are using monitors with low screen resolution

So maybe you can already understand what I’m trying to say. Accessibility is not a waste of time. Rather it is giving more than one ways to your users to see, surf and visit your site.

Do you know that if you’re a business owner in the United States (and in some other countries as well) and or someone who owns a website in that (those) area/s, you can be sued if your site is not accessible?

As a matter of fact, back in June 1999, the Sydney Organizing Committee for the Olympic games was sued by a single individual by the name of Bruce Maguire due to web inaccessibility. To make long story short — the International Olympic Committee lost the case.

So despite what other people say, making your site accessible is not an option.

For content creators, the lesson of this case is simple: Accessibility is easy, it is not optional, and if you keep ignoring it you may someday find yourself in court. If an organization as powerful as a national Olympic organizing committee – with effectively unlimited resources and, on the part of its paterfamilias, the International Olympic Committee, a century-long history of exclusion and inaccessibility – can lose a case like this, other cases resting on similar legal principles are likely to prevail.

Reader’s Guide to Sydney Olympics Accessibility Complaint

How to Make your Site Accessible

The following are just simple steps in making your site accessible:

  • Add skip links so that people who are using screen readers or who are interested in reading your content right away can skip your menu items.
  • Make sure that your background and foreground colors have enough contrast
  • Images must have alt attributes that describes or says what is in the image, this way, if the image did not load at all then the user will know what the image is all about
  • If the image is too complex to describe in a few words the you should provide long description for that
  • If the image is only there for decorative purposes then you should either put it in your stylesheet or if it can’t be helped, then make sure that your alt attribute be blank so that screen readers can just skip it
  • If you have a video or audio file in your site then you should provide a transcript for that for people who are too lazy to watch or listen or do not want to download the file will still be able to understand what the file is all about
  • Provide the right hierarchy for your document, it’s the same with what I said in my last post where a document should only have 1 h1 which will be followed by h2(s) and then h3 where an h3 should never follow an h1
  • Keep moving objects in your site at a minimum
  • Make sure that your document will still make sense even if the style sheet is not present
  • Tables should only be used if you’re presenting a tabular data
  • Optimize images so that it will not take too much time to load

Those are just the simplest steps that one can do to make sure that your site is accessible, it won’t ensure 100% accessibility of your site but it’s still better than 0%, right?

Read more on best plasma cutter :

When ‘is_home()’ doesn’t work

Note: This has been written a long time ago, some of the stuff here might not work anymore. I’d recommend using <?php is_frontpage(); > when using static frontpage instead. You can also visit the WordPress Codex for more information or contact me and I’ll try my best to help you.

You hacked your WordPress homepage because you don’t intend to make a blog out of it and then all of a sudden the very useful conditional tag <?php if(is_home()) ?> no longer works. It happened to me twice and for that 2 occurrences, I couldn’t find a solution until a couple of days ago.

I’m working on this project where I don’t need to show my posts anywhere aside from the category archive and single, not even in the homepage. What the client wants is that the home page should show all of the categories in the site, no matter if it’s empty or not and a certain page content must be pulled into it. Because I’m lazy in creating a page template just for that and assigning that page as the home page, I modified the main index template instead.

Those things are actually easy to do. All I have to do is to write this within the main index template:

<?php wp_list_categories('order_by=name&hide_empty=0&title_li='); ?>

so it’ll show all of the categories ordered by the category name whether it has posts or not. And for the page to be pulled into the main index, query_post is the answer:

<?php query_posts('page_id=ID'); while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); endwhile; ?>

so it’ll show the title and the contents of the page ID.

It worked just as expected and I was so proud of myself until the client asked that the sidebar for the home page be different from the rest of the site. That’s when I knew that the is_home() doesn’t work.

I searched high and low for in the codex and support forum but couldn’t find anything. I can’t tell the client that I can’t fix this so I tried my hunch if it works. I’m not the type who is a big fan of plugins because I’m afraid that if the site rely heavily on plugins and and if and when that certain plugins’s developer goes AWOL, the site might go berserk due to incompatibility and all I could do was search again for a plugin that could replace it.

I thought that the home page is being treated by wordpress as if it’s a page because I did pull the contents of a page into it. Turns out that I was right!

When I put <?php if(is_page('ID')) { ?> in the sidebar, it worked just as I wanted it to.

So now, I realized that once you’ve changed the content of your main index template, know that you are also taking out it being your “home” because it will start acting like a page (if you pulled a page into it).

Being productive with CSS

I don’t know about other people but I, for one, use a lot of classes in every design project. So with every project that I have to code, I have to put all of them again and again and again that there are moments that I was not able to add some of them altogether.

For example are the classes that enables you to float a certain element (to use for images and whatnots), I always call it alignright or alignleft, always. I have never thought how slow that made me in creating CSS because every time I do one I tend to forget one or more class (or element) or worse, I forget how I was able to do it in one site (e.g. losing the quotation marks in quote tags) that I have to open the CSS file for that site again. I have always thought of creating a default CSS that will have all of the classes that I always use plus the default appearance of almost all of the elements.

Classes it is understandable but why elements you ask? Well, one main reason is still the pesky IE. IE does not render quote tags the same way that the new browsers do, i.e. they do not put quotation marks before and after the quote tags to signify that it is a quote. So what I do is take out the quote on all of the browsers in CSS and instead put the hex decimal for quotation marks — &ldquo ; (minus the space) for left quote and &rdquo ; for right quotes. If we have to lose support for IE 6, I have to say that it will be pretty hard to maintain. But that may not for how many years from now.

So, here is what my default CSS looks like, feel free to use it if you like:

a img { 
   border:0 none; 
q:after, q:before {
   content: '' 
code, samp, kbd, pre, tt { 
   font-size: 115%; 
pre code, code pre { 
acronym, abbr {
   border-bottom: 1px dotted #000; cursor: help; 
dfn { 
   font-style: italic; 
dl dt { 
   font-weight: bold; 
dl dd { 
   margin-left: 0; margin-bottom:.8em; 
ul li, ol li { 
   margin-bottom: .3em; 
fieldset { 
   border:0 none; 
th, caption { 
   text-align: center; 
legend { 
   font-weight: bold; 
   font-size: 120%; 
input, select, textarea { 

.clear { 
   clear: both; 
.right { 
   text-align: right; 
.left { 
   text-align: left; 
.alignright { 
   margin-left: .8em; 
   margin-bottom: .8em; 
.alignleft { 
   margin-right: .8em; 
.center { 
   text-align: center; 
.strong { 
.italic { 
   font-style: italic; 
.navigation { 
   padding: .8em 0; 
   text-align: center; 
   font-family: Georgia, "Times New Roman", Times, serif; 
   font-size: 105%; 
   font-weight: bold; 
	.navigation ul, navigation li { 
            list-style: none; 
            margin: 0;
            padding: 0; }
	.navigation li {
            display: inline; 

Have I missed to style any important element?

I used relative measurements so that I don’t have to edit it anymore whenever I have to use it. I also do not put any specific rule such as borders, background colors and those that depends on the look and feel of the site.

What do you do to make your coding easier?