首页 > 解决方案 > 如何在我的 sass 文件中插入图片?

问题描述

我试图插入我的图片,但我不能:(对不起,但我总是遇到同样的问题:我的 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;
}

我的文件也总是一样的:

我总是404错误...

标签: drupalsasspathtwig

解决方案


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


推荐阅读