How do I force close a tag in jade templates?

放肆的年华 提交于 2019-12-11 12:39:56

问题


How do you force close a tag in jade? This may be a be a bad example, but If i wanted to put a div in between the </head> & <body>


回答1:


Just write HTML in your jade

doctype html
html(lang="en")
  <head></head>
  body jade again

But you cannot put jade into your head elements, so when you start using HTML you cannot mix its content and children with jade.




回答2:


If you wanted to put something like <div class="your-content"></div> between the body and head, you don't need to resort to plain html. Instead:

doctype html
html(lang="en")

  head
    ...more pug/jade...

  .your-content
    ...more pug/jade...

  body
    ...more pug/jade...


来源:https://stackoverflow.com/questions/25650988/how-do-i-force-close-a-tag-in-jade-templates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!