Posts tagged with: "browserized_styles"

Announcing 'Browserized Styles'

by Michael Bleigh on December 9, 2007 • filed under rails css Rails plugins announcements browser compatibility style browserized_stylescomment

Browser compatibility, the web designer’s nightmare, has always seemed more difficult than it has to be. Why hasn’t there been an industry-standard, simple way to target CSS to specific browsers, allowing one to style the page properly without worrying about hacks and other difficult ways of pulling all the information together? I thought that something should be done about it, so taking Richard Livsey’s ‘browser_detect’ plugin as a starting point, I developed an automatic solution for including browser-specific stylesheets.

Browserized Styles provides a dead simple way to create browser-specific CSS code for
use in a Rails application. All you need to do is create a .css file targeted to
a browser by appending an underscore and identifier to the end.

Installation


script/plugin install http://svn.intridea.com/svn/public/browserized_styles

Example

Let’s say I have some complex CSS code that looks bad in some browsers, but works in
others. Let’s also say that i’ve put it into a stylesheet in stylesheets/complex.css.

My stylesheet link tag looks something like this:

<%= stylesheet_link_tag 'complex' %>

Now all I have to do to target a browser is create a new CSS file with the browser’s
identifier appended to it with an underscore (e.g. “complex_ie6.css”). That’s it!
The same exact stylesheet link tag will automatically check the current user
agent and load a browser-specific CSS file if it exists. Ta-da! One-step browser
styles!

More information is available in the readme, but the end result is browser-targeting bliss.

The plugin is brand new and will probably see some modifications in the future. If you run into any problems or come up with a patch, feel free to submit it to the Intridea Public Trac .

Comment | 

Words we've written view all blog posts »

Featured Article

Grub.it Launched - Location-Based Dish Review Web & Mobile Application

by Brendan Lim on March 16, 2010

Today we are excited to officially launch Grub.it, a location-based web and mobile application that enables people to find or review individual dishes at restaurants wherever they may be. Grub.it exists to help you find top notch meals wherever you are and aims to connect you with local specialties, hidden gems and exquisite dishes in general. Continue reading »

Recent Blog Posts

Friday Coffee Hour at Intridea

by Renae Bair on March 17, 2010

Grub.it Launched - Location-Based Dish Review Web & Mobile Application

by Brendan Lim on March 16, 2010

Hashie Gains a Chainable Hash

by Michael Bleigh on March 5, 2010