Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Rounded Corners in Rails: The Easy Way

By Peter Cooper / June 5, 2006

A few days ago I learned about Curvy Corners, an incredible JavaScript that lets you put rounded corners on your DIV elements that can do anti-aliasing and handle any size border. It's the best rounded corner script so far.

Craig Webster saw it too and has created a Curvy Corners in Rails helper method that means you can do stuff like:

<% curvy_div(:tl => false, :br => false) do -%>
  Oyy, stylish.
<% end -%>

Very neat.

Comments

  1. Richard White says:

    Curvy Corners seems to use a *lot* of DIVs in accomplishing some of the best rounded corners I have seen. I'm a little hesistant to add ~220 divs to my page for each rounded corner.

  2. Peter Cooper says:

    Unfortunately so. It's just a shame this workaround is required. One DIV for each pixel? It's funny in a sad way!

    That said, I feel similarly about the thousands of lines of JavaScript being thrown into almost every pageload nowadays, and browsers seem to be coping with it (just), so it might not be so bad after all.

Other Posts to Enjoy

Twitter Mentions