如何将CSS链接到Jade文件?

27

我目前正在尝试链接normalize.css,但它不起作用(使用socket和express)

html
        head
                title= "Real time web chat"
                link(href='/css/normalize.css')
                script(src='/chat.js')
                script(src='/socket.io/socket.io.js')
                script(src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js')
        body
                #content(style='width: 100%; height: 600px; margin: 0 0 20px 0; border: solid 1px #999; overflow-y: scroll;')
                .controls
                        | Name: 
                        input#name(style='width:350px;')

                        input#field(style='width:350px; display: inline; margin-left -90px;')
                        input#send(type='button', value='send')
1个回答

54

你需要rel

link(href='/css/normalize.css', rel='stylesheet')

当我查看源代码时,它显示“无法获取/css/normalize.css”。 - Swat Designz
你可能会得到错误的路径。如果你使用Express默认文件夹模板,normalize.css应该在public/css/目录中。 - Khanh Nguyen
谢谢,我把它放在了我自己创建的CSS文件夹里。 - Swat Designz
rel=stylesheet 对我来说是解决方案。谢谢。 - KhoPhi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接