I have been trying <br>
tag in haml, very unfortunately none of my code are working. How should we use nest for <br>
in haml ?
%h1 Helo mate
%br/
whrere are you ?
Join Stack Overflow to learn, share knowledge, and build your career.
I have been trying <br>
tag in haml, very unfortunately none of my code are working. How should we use nest for <br>
in haml ?
%h1 Helo mate
%br/
whrere are you ?
Your example (%br/
) already seems to be correct.
Whether you get a selfclosing tag (<br />
) or a standalone tag (<br>
) depends on whether your code is interpreted as html or as xhtml, so check which format you need. Xhtml has problems with non-closing tags.
Look here for more info.
Edit: Adding the info from matt's comment. The problem is not the br
tag, but the content of the h1
tag being on the same line as the tag as well as on the next line, while the whole content should be nested when the content is more than one line:
%h1
Hello mate
%br/
where are you?
Illegal nesting: content can't be both given on the same line as %h1 and nested within it.
.
– matt
Dec 1 '15 at 17:24
%h1
Hello mate
%br where are you
<br>where are you</br>
, which is wrong (br
can’t have content).
– matt
Dec 1 '15 at 15:35