Mo.
Mo.

Reputation: 27503

How to use br tag in haml?

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 ?

Upvotes: 7

Views: 8238

Answers (2)

Raimund Kr&#228;mer
Raimund Kr&#228;mer

Reputation: 1309

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?

Upvotes: 10

Nagendra jain
Nagendra jain

Reputation: 65

%h1
  Hello mate
  %br where are you

Upvotes: 1

Related Questions