【问题标题】:How I can insert my picture in my sass file?如何在我的 sass 文件中插入图片?
【发布时间】:2019-01-02 12:59:30
【问题描述】:

我正在尝试插入我的图片,但我不能:( 抱歉,但我总是遇到同样的问题:我的 TWIG 代码:

<div class="col-6">
  <div class="phone">
  </div>

还有我的 SASS 代码:

.phone {
  background: url('phone.png') no-repeat;
  background-size: contain; /*This scales the image accoding to the div*/
  background-position: center; /*positions the image in the center*/
  width: auto;
  height: 50px;
}

我的文件也总是一样的:

  • 主菜单
    • 电话.png
    • menu.scss

我总是遇到 404 错误...

【问题讨论】:

    标签: drupal sass path twig


    【解决方案1】:

    url() 中定义的路径需要相对于您编译的.css 文件而不是.scss 文件。

    【讨论】:

      猜你喜欢
      • 2019-05-27
      • 2023-02-04
      • 1970-01-01
      • 2015-11-22
      • 2018-02-26
      • 1970-01-01
      • 2012-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多