如何使用带有玉模板的样式标签? [英] How to use the style tag with jade templates?

查看:40
本文介绍了如何使用带有玉模板的样式标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月前,这种样式代码对我有用.我已经更新到最新的 Jade NPM 包,现在它不工作了.有人可以帮助我以正确的方式在 Jade 模板中内联样式吗?

This style code worked for me a few months back. I have updated to the latest Jade NPM package and now it is not working. Can some please assist me with the proper way to inline a style in a Jade template?

doctype 5
html(lang="en")
    head
        style(type='text/css')
           .ui-title {
                margin: 0.6em 10% 0.8em !important;
            }

我在结束时收到此错误 }

I get this error on the closing }

unexpected text }

推荐答案

在 Jade 中将文本放入标签的三种方式

There are three ways of putting text inside your tags in Jade

h1 Some header text

输出将是:

<h1>Some header text</h1>

2.使用 | 将缩进文本放在标签下方,例如

2. Put indented text below the tag with | e.g.

p
    | Some text goes 
    | here

输出将是:

<p>Some text goes here</p>

3.在标签后加一个点并在下面缩进你的文本(没有 |)例如

p.
    This way 3rd way of putting 
    text inside

输出将是:

<p>This way 3rd way of putting text inside</p>

<小时>

因此,根据上述情况,您选择的方法(如您的评论中所述)是正确的(选项 3).

doctype 5
html(lang="en")
    head
        style(type='text/css').
           .ui-title {
                margin: 0.6em 10% 0.8em !important;
            }

我希望这会有所帮助.

这篇关于如何使用带有玉模板的样式标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆