How to set inline style for element in HAML

ValeriiVasin picture ValeriiVasin · Nov 11, 2011 · Viewed 80k times · Source

Here is my code:

<div class='some' style='position: absolute; left: 300; top: 300;'>..</div>

It parses only style='position: absolute', and doesn't parse the other styles. How can I achieve this?

Answer

Dan Cheail picture Dan Cheail · Nov 11, 2011

It would have been handy if you'd posted the HAML you're using, but this is how it's done:

%div.some{ :style => "position: absolute; left: 300px; top: 300px;" }