Hacked to Death iii

November 24th, 2006

Hacked to Death iii
While testing Krugle for my pending review I was able to find a Safari hack that works.

You may already have heard of the Safari Stokely Hack. It’s not as straight forward as most IE hacks but it works on even the latest versions of Safari and can be a real life saver.

View details on the Stormdetector website.

Now IE7 is here hacks have to be more specific in their targeting. Some Beta versions of IE7 ignore * html hacks and some apply them (The final release ignores them).

To be sure which browser will be affected by your styles you can use conditional comments.

e.g.
<!--[if lte IE 6]>
(html for IE 6 or older goes here)
<![endif]–>

This goes into your html not your css file. The version(s) of IE you specify will read the code you enter within the comments while other browsers will ignore it. This means you can link to a seperate style sheet with your IE hacks in and it will not affect other browsers.

Selecting versions to affect:

To affect just one version of a browser (e.g. IE7) simply start your conditional comment with <!–[if IE 7]> replacing 7 with whatever browser version you want to target. If you want to target a range of browsers you can insert an extra word before IE.

  • lte - less than or equal to
  • lt - less than

Because you have targeted a specific set of IE browsers future releases should be happy viewing your page without the hacks getting in the way.

These conditional comments can be used to hide any other html from non-IE browsers too, such as an IE only feature you may have on your page.

Hacked to Death ii (Safari)

October 8th, 2006

Apologises for the lack of posts the last few days. I’ve not been on holiday, far from it, I’ve started a new contract. I will be producing for a leading media company.

This actually brings me nicely onto this blog entry’s topic - Hacking Safari. I am used to testing on the major PC based browsers (FireFox, IE, Opera and to a lesser extent Mozilla, Netscape, linx) but have never been required or had the hardware to test with Macintosh’s Safari.

For the most part if a design works in FF and IE, Safari will quite happily play along. However, on one page where I have used relative positioning to move an image up by a few pixels I encountered a problem. FF and IE6 didn’t line up. I was forced to use an IE6 hack (see previous hacked to death entry) to set a different pixel adjust for the two browsers. While this solved the problem in IE6, Opera, FF and IE7 - Safari was not happy.

While Safari had rendered the page as FF it treated the positioning of this image as IE6. As IE6 hack only affects IE6 and older Safari’s positioning of he image is not corrected. Quiet a problem.

Thus began my quest to find a CSS hack that only affected Safari. Preferably an elegant hack (if there is such a thing) still allowed my style sheet to validate and would not affect future versions of The browser.

Continue reading »

Hacked to Death

September 27th, 2006

Code Hacked to Death

Everyone working on the front lines (building for the front-end) will have likely encountered a page that despite being a coding piece of art looks great in one browser but falls apart in another.

If you don’t work for Microsoft you’ll know the problem is usually with the Internet Explorer browser. A lot of the time tweaking a style sheet a little can solve things but sometimes there is no other option but to add a hack.

No one likes hacks, in fact I go to insane lengths trying to find an alternative before I will use one. However, if it is necessary to ad a hack is there a good way, or is a hack always going to be ugly and we just have to face it?
Continue reading »