Html 你如何在 .jade 文件中添加新行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19141464/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 14:02:38  来源:igfitidea点击:

How do you do new lines in .jade files?

htmlpug

提问by gjw80

How do you do new lines in .jade files? Something which would effectively correlate to
in html. I saw that you can put things on new lines using the list (ul : li) commands but it seems to break when you assign a blank line to a li: command.

你如何在 .jade 文件中添加新行?与
html有效相关的东西。我看到您可以使用 list (ul : li) 命令将内容放在新行上,但是当您将空行分配给 li: 命令时,它似乎会中断。

What I'd like is the submit button to appear a couple blank lines down from the 'uPass' input box:

我想要的是提交按钮,它会在“uPass”输入框下方出现几行空白行:

block content
            form(method='post',action='/login')
                input(name="uName" type="text" placeholder="User Name")
                input(name="uPass" type="password" placeholder="Password")
                input(type="submit" value="Login")

回答by Prinzhorn

The correct answer is: use CSS to add a space between the elements.

正确答案是:使用 CSS 在元素之间添加一个空格。

Anyway, here's how you add a <br>in Jade (it's THAT simple)

无论如何,这是<br>在 Jade 中添加 a的方法(就这么简单)

block content
    form(method='post',action='/login')
        input(name="uName" type="text" placeholder="User Name")
        input(name="uPass" type="password" placeholder="Password")
        br
        br
        input(type="submit" value="Login")

Or even

甚至

input(name="uPass" type="password" placeholder="Password")
| <br><br>
input(type="submit" value="Login")

回答by tymeJV

Use the |to do a new line, so:

使用|来做一个新行,所以:

ul
  li
    | Some text in your li
    | Some more text  

Or use the .

或者使用 .

ul
  li.
    Ya some li text!
    More!

回答by ExillustX

You can use this mixin:

您可以使用此混合:

mixin newline()
  | #{'\n'}

Then call it:

然后调用它:

b text
+newline
b more text

The results:

结果:

<b>text</b>
<b>more text</b>