node.js - 在 Jade 中使 span 位于文本之前

标签 node.js twitter-bootstrap express pug

我正在开发一个导航栏,我试图在导航栏上设置一个按钮,格式如下:

(图标)(文本)

以下是 Jade 文件的摘录:

a(href="/signup")
  h3 Sign Up  
    span(style="font-size: 1.25em; margin-top:2%" href="/graphing").glyphicon.glyphicon-pencil

目前这会产生:

(文字)(图标)

我怎样才能让跨度位于 h3 内部,但位于 jade 中的文本之前?

最佳答案

您应该使用管道文本:

a(href="/signup")
  h3
    span(style="font-size: 1.25em; margin-top:2%" href="/graphing").glyphicon.glyphicon-pencil
    | Sign Up
<小时/>

来自The documentation :

Piped Text

The simplest way of adding plain text to templates is to prefix the line with a | character (pronounced "pipe").

关于node.js - 在 Jade 中使 span 位于文本之前,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22084268/

相关文章:

javascript - 如何使用 Express 函数从 javascript 页面调用 PHP 页面

javascript - NodeJS Express Api——调用 res.send 外部路由有效,但 res.status 无论如何都不起作用

javascript - 如何在 Graphql 模式中定义日期数据类型?

database - 类方法和实例方法有什么区别[sequelize]

node.js - expressjs - 管道到响应流不起作用

html - 从 Bootstrap 中的表顶部删除行

javascript - 找不到模块 'ldapjs'

jquery - Bootstrap : Dropdown in top navbar in fixed place

css - bootstrap 2.3.2 行不是内联的

mysql - 如何在EXPRESSJS/MYSQL中获取父子关系?