简体   繁体   English

如何使用 Jade HTML 添加 br 标签

[英]How to add br tag with Jade HTML

I need add br tag but this not working.我需要添加 br 标签,但这不起作用。

table
    tbody
        td Juan Perez
        td 01 33 4455 6677
        td Av José Vasconcelos 804-A Pte. 
            br Col. Los Sabinos,CP. 66220, San Pedro, N.L.

Put the text on a new line with a preceding |将文本放在一个新行上,前面有| :

table
  tbody
    tr
      td Juan Perez
      td 01 33 4455 6677
      td Av José Vasconcelos 804-A Pte.
        br
        | Col. Los Sabinos,CP. 66220, San Pedro, N.L.

You could also place both text nodes on new lines to improve readability as well:您还可以将两个文本节点放在新行上以提高可读性:

table
  tbody
    tr
      td Juan Perez
      td 01 33 4455 6677
      td
        | Av José Vasconcelos 804-A Pte.
        br
        | Col. Los Sabinos,CP. 66220, San Pedro, N.L.

Output:输出:

<table>
  <tbody>
    <tr>
      <td>Juan Perez</td>
      <td>01 33 4455 6677</td>
      <td>Av José Vasconcelos 804-A Pte.<br/>Col. Los Sabinos,CP. 66220, San Pedro, N.L.</td>
    </tr>
  </tbody>
</table>

An alternative syntax to the one proposed by Josh is the following: Josh 提出的另一种语法如下:

table
  tbody
    tr
      td Juan Perez
      td 01 33 4455 6677
      td. 
        Av José Vasconcelos 804-A Pte. #[br]
        Col. Los Sabinos,CP. 66220, San Pedro, N.L.

The dot at the end of the td is used to enter large blocks of plain text in a simpler way, so the following indented block is treated as text, and you don't need to use the pipe ( | ) preceding every line. td末尾的点用于以更简单的方式输入大块纯文本,因此后面的缩进块被视为文本,您不需要在每一行之前使用管道 ( | )。 (Source: https://pugjs.org/language/plain-text.html ) (来源: https : //pugjs.org/language/plain-text.html

Then, to get your explicit <br> , you can use the tag interpolation syntax #[br] to inline it inside the text.然后,为了获得显式<br> ,您可以使用标签插值语法#[br]将其内联到文本中。 (Source: https://pugjs.org/language/interpolation.html ) (来源: https : //pugjs.org/language/interpolation.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM