Avatar

While I strongly advise using hacks at a minimum especially when it comes to CSS there is a time and a place for them, especially when you need a quick way to target a browser other than Internet Explorer.

CSS Hacks: The Problem

Most standards favoring browsers (Firefox, Opera & Safari) have no method of targeting CSS to the specific browser while Internet Explorer, the buggiest browser, has a completely safe and easy method of serving CSS/HTML to only IE.

The Setup

To show that the hacks are working correctly I created 6 paragraphs with their specific browser/version identifier within them. This will let you know that the hack is working correctly
<p id=”opera”>Opera 7.2 – 9.5</p> <p id=”safari”>Safari</p> <p id=”firefox”>Firefox</p> <p id=”firefox12″>Firefox 1 – 2 </p> <p id=”ie7″>IE 7</p> <p id=”ie6″>IE 6</p>

Next I automatically hid all P tags:
<style type=”text/css”> body p { display: none; } </style>
Targeting Internet Explorer With CSS Using Conditional Comments

The easiest way to target IE is with conditional comments. There is a robust syntax that Microsoft has created to allow authors to do this. I’m not going to go into detail about this since it has been re-hashed a million times by other bloggers but here are two alternatives to parser CSS hacks:
<!–[if IE 7]> <style type=”text/css”> </style> <![endif]–> <!–[if IE 6]> <style type=”text/css”> </style> <![endif]–>

Targeting Internet Explorer With CSS Using Parser Hacks

I wouldn’t recommend using these hacks since conditional comments are really, really easy to use but if you want to keep all your CSS in one file here is an alternative. Note that the IE7 hack will only apply to IE7 because IE6 does not understand the > selector. It should also be noted that no other browser will recognize this hack.
/* IE 7 */ html > body #ie7 { *display: block; } /* IE 6 */ body #ie6 { _display: block; }

Read the rest of this post »

Tagged with: , , , , .
Avatar

tmp357Opera Software released the beta version of their Opera Mobile 9.5 browser . Much like users of the iPhone’s Safari browser, Opera Mobile users can enjoy both slimmed-down sites made for mobile, as well as standard desktop versions right from their phone.

Though still in beta, today’s release promises faster performance, enhanced viewing functionality, and better usability over v8.65.

Specifically, here are the features Opera described in their press release today:

Faster — Opera has always been among the fastest browsers — if not the fastest — available. Opera Mobile 9.5 beta continues this fine tradition with improved performance over Opera Mobile 8.65.

Pan and zoom — Just like Opera Mini, Opera Mobile 9.5 beta defaults to full Web page viewing and allows users to pan and zoom into their desired content easily.

Improved user interface — Opera has completely renovated its mobile UI. Cleaner and more intuitive, the new UI is designed for quick and easy navigation.

Opera Dragonfly — Use your Opera desktop browser to debug sites on your mobile phone through the Opera Mobile 9.5 debug menu.

Improved standards support — Opera Mobile 9.5 is the most standards compliant browser available, and the company remains steadfast in its commitment to make the Web accessible for all.

Save pages and/or images — With a click, simply save pages to your phone.

Tagged with: , , , .