【问题标题】:Ionic background img on div not loading LOCAL images but loads images from internet urlsdiv上的离子背景图像不加载本地图像,而是从互联网网址加载图像
【发布时间】:2015-11-28 07:33:37
【问题描述】:

我有这个 div,它正在从互联网加载完美的图像 url,但不是我的本地图像,非常奇怪:

   <div class="col biggest-grid dir-medico-grid" ng-click="showDirMedico()">
          <img src="../img/dirmedico.png" class="img"/>

          <p>DIRECTORIO MÉDICO</p>
        </div>

所以当我尝试这个时它没有问题:

.dir-medico-grid{
  background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/652/confectionary.png);

}

但如果我试试这个:

.dir-medico-grid{

  background: url(../www/img/doctors.jpg);
}

现在它不起作用,因为你可以确保我的路径是正确的,我将从 ionic.app.scss 转到 doctors.jpg:

我尝试过使用background: url(../www/img/doctors.jpg) no-repeat center center fixed;,使用'../www/img/doctors.jpg'"../www/img/doctors.jpg",使用background-image而不是background,但似乎没有任何效果,这很奇怪。

【问题讨论】:

  • 在本地机器上使用图片的完整路径只是为了测试。让我们知道结果。
  • 试试background: url('/www/img/doctors.jpg');css-tricks.com/quick-reminder-about-file-paths
  • @chrisbedoya 没用,但它有效 background: url('../img/doctors.jpg'); 我很困惑!

标签: html css ionic-framework ionic ionic-view


【解决方案1】:

仅在 html 中使用 img/dirmedico.png

<img src="img/dirmedico.png" class="img"/>

对于 CSS

.dir-medico-grid{

  background: url("../img/doctors.jpg");
}

对于 html,所有模板都呈现在 index.html 上,该 index.html 与 img 在同一目录中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-07
    • 1970-01-01
    • 2013-08-22
    • 1970-01-01
    • 2017-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多