Posted by Vince Wadhwani on May 18, 2008

My HAML adventures continue. This time, I'm documenting how to limit the length of a table or table cell. Usually I'd just do something like

 <td width = "500px">

but with HAML you've got to take a different approach. Fortunately it's not that hard:

 %td{:width => 20}=My cell contents

Once you know the syntax, things begin to make sense. Another example, to set the border of your table, you can use this:

 %table{:border => 1}