【问题标题】:bootstrap css is not loading in .ejs file?bootstrap css 没有加载到 .ejs 文件中?
【发布时间】:2021-07-19 18:34:32
【问题描述】:

我是 ejs 和 Nodejs 的初学者。我有 Nodejs 文件。每当 localhost 遇到获取请求时。我正在重定向这个 index.ejs 文件。我正在浏览器中获取数据。但是css没有加载这段代码有什么问题。我附上了示例代码...谁能给我解决方案。提前谢谢...

index.ejs


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link ref="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
</head>
<body>
    <div class="container">
        <div class="jumbotron text-center">
            <h1>User Authentication with Passport,Express4 and MongoDB </h1>
            <h3>Login or Register with...</h3>
            <a href="/login" class="btn btn-lg btn-success">Login</a>
            <a href="/register" class="btn btn-lg btn-info">Register</a>
        </div>
    </div>
</body>
</html>

【问题讨论】:

    标签: css node.js bootstrap-4 ejs


    【解决方案1】:

    我用过:

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

    一切正常……

    【讨论】:

      【解决方案2】:

      使用 rel="stylesheet" 代替 ref="stylesheet"

      【讨论】:

      • 是的,与 2019 年的现有答案完全相同...请不要发布已经发布的解决方案。
      • 这个答案已经包含在上面给出的答案中。
      猜你喜欢
      • 2021-11-02
      • 1970-01-01
      • 1970-01-01
      • 2013-09-08
      • 1970-01-01
      • 2017-11-06
      • 1970-01-01
      • 2022-11-08
      • 2010-12-31
      相关资源
      最近更新 更多