【问题标题】:Advice sleuthing down why Bootstrap CSS not working in Express调查为什么 Bootstrap CSS 不能在 Express 中工作的建议
【发布时间】:2015-05-06 01:22:42
【问题描述】:

我正在学习 Express.js,并在我的 layout.jade 中包含了 Bootstrap。问题是,样式没有显示出来。任何关于如何解决这个问题的建议表示赞赏。

这是 layout.jade:

doctype html
html(lang='en')
  head
    title=MiniApp
    link(rel='stylesheet', ref="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css")
    link(rel='stylesheet', ref="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css")
  body
    block content
    script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js')

这里是 index.jade 的第一部分,唯一的另一个 Jade 文件(我刚刚将 an example Bootstrap file 转换为 Jade。):

extends layout

block content
  nav.navbar.navbar-inverse.navbar-fixed-top
    div.container
      button.navbar-toggle.collapsed(data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar")
        span.sr-only Toggle navigation
  ...etc.

主要的是,它在一个容器 div 中,但页面仍然呈现没有任何样式。为什么?

其他一些solutions 建议使用 Bower,但我没有使用 Bower。

【问题讨论】:

    标签: css twitter-bootstrap pug


    【解决方案1】:

    你应该使用 href 而不是 ref

    link(rel='stylesheet', href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-25
      • 2021-09-08
      • 2022-11-02
      • 2014-09-28
      • 2011-01-15
      • 2018-02-24
      相关资源
      最近更新 更多