【问题标题】:How to use br tag in haml?如何在haml中使用br标签?
【发布时间】:2015-12-01 11:44:13
【问题描述】:

我一直在尝试在 haml 中使用 <br> 标记,很遗憾我的代码都没有工作。我们应该如何在haml中使用nest for <br>

%h1 Helo mate 
  %br/ 
  whrere are you ?

【问题讨论】:

标签: haml


【解决方案1】:

您的示例 (%br/) 似乎已经正确。 您获得的是自闭合标签 (<br />) 还是独立标签 (<br>) 取决于您的代码被解释为 html 还是 xhtml,因此请检查您需要哪种格式。 Xhtml 有非结束标签的问题。

Look here 了解更多信息。

编辑:添加来自马特评论的信息。问题不是br标签,而是h1标签的内容与标签在同一行以及下一行,而当内容超过一行时,整个内容应该嵌套:

%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..
【解决方案2】:
%h1
  Hello mate
  %br where are you

【讨论】:

  • 这会产生<br>where are you</br>,这是错误的(br 不能有内容)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-13
  • 2014-12-06
  • 1970-01-01
相关资源
最近更新 更多