首页 > 解决方案 > 背景图片 url() 不使用 sass 编译

问题描述

我在 VS 代码中使用 Live Sass 编译器。早些时候,我使用 Node JS 将 sass 转换为 css。代码工作正常,但我在 css 中看不到任何背景图像 url()。它也不会在输出中显示背景。scss 文件中的图像路径正确。我为此使用变量。

$show-home-image: true;
$home-image: url(../img/background.jpg);
$background-opacity: 0.9;
@mixin background {
  @if $show-home-image {
    &#bg-img {
      background: $home-image;
      background-attachment: fixed;
      background-size: cover;

标签: htmlcsssasscompilationbackground

解决方案


推荐阅读