HOWTO: Avoid this error "Illegal nesting: content can't be both given on the same line as %div and nested within it."

1,018 views
Skip to first unread message

explainer

unread,
Feb 2, 2012, 11:42:42 AM2/2/12
to Haml
I have the following html snippet I wish to translate to haml:

<div id="person-template" style="display: none;">
<div class="person">
<p class="name"><b>Name:</b> </p>
<p class="nickname"><b>Nickname:</b> </p>
<p class="occupation"><b>Occupation:</b> </p>
<p class="rank"><b>Rank:</b> </p>
</div>
</div>

I have not been able to figure out how to code the '
style="display:none;" ', I keep getting the error listed in the
subject line above. What am I missing?

Kit

unread,
Feb 9, 2012, 3:53:12 AM2/9/12
to ha...@googlegroups.com
2012/2/2 explainer <kebu...@gmail.com>:

#person-template(style="display:none;")
.person
%p.name
%b Name
%p.nickname
%b Nickname
--
Kit

tonyganch

unread,
Feb 9, 2012, 12:55:16 AM2/9/12
to Haml
Your code should look like this:

#person-template{:style => "display: none"}
.person
%p.name
%b Name:
%p.nickname
%b Nickname:
%p.occupation
%b Occupation:
%p.rank
%b Rank:
Reply all
Reply to author
Forward
0 new messages