html - sass 已编译但无法在我的浏览器中运行

标签 html css sass

这是我的html代码:

<!DOCTYPE html>
<html>
<head>
    <title>nested</title>
    <link rel = "stylesheet" type = "text/css" href = "style.scss">
</head>
<body>
    <div class = "class1">
         <h1>Heading</h1>
         <p id="p1">Paragraph 1</p>
         <p id="p2">Paragraph 2</p>
         <div class = "class2">
            <h1>Heading</h1>
            <p>Paragraph</p>
         </div>
      </div>
</body>
</html>

这是我的 style.scss:

.class1{
   h1{
      font-size: 25px;
      color:#E45456;
   }

   #p1{
      font-size: 25px;
      color:#3C7949;
   }
   #p2{
      font-size: 25px;
      color:#3C7949;
   }

   .class2{
      h1{
         font-size: 25px;
         color:#E45456;
      }

      p{
         font-size: 45px;
         color:#3C7949;
      }
   }
}

我的 style.scss 在命令提示符下被编译,一个新的 style.css 也被生成。但是在网络浏览器上,我的页面没有我给它的任何样式。

最佳答案

因为,您需要引用您的 CSS 文件而不是 SCSS 文件。 浏览器无法呈现用于样式化的 SCSS 文件。

检查您的 html 代码,您引用了错误的文件。 enter image description here

关于html - sass 已编译但无法在我的浏览器中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42623223/

相关文章:

javascript - intro.js - 重新定位进度条并放在底部(步骤下方)

html - 将表格样式应用于除第一列以外的所有列

css - 单独的 navbar 和 navbar-inner 类的目的是什么?

css - 像在 Bootstrap 中使用的下拉菜单

css - Sass/Compass 压缩输出仍然不足以用于 Google Pagespeed Insights

html - 汉堡菜单图标过渡问题 scs

css - 在 Angular 2 中使用 Sass

html - 展开元素以适应表格单元格内容器的其余部分

javascript - 在鼠标事件上启动/停止函数执行 jQuery/JS

html - 为什么 flex 元素不缩小过去的内容大小?