html - div 上的 ionic 背景 img 不加载本地镜像,但从互联网 url 加载图像

标签 html css ionic-framework ionic-view

我有这个 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:

enter image description here

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

最佳答案

在 html 中仅使用 img/dirmedico.png

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

对于 CSS

.dir-medico-grid{

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

事情是针对 html 的,所有模板都在 index.html 上呈现,它与 img 位于同一目录中。

关于html - div 上的 ionic 背景 img 不加载本地镜像,但从互联网 url 加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32359139/

相关文章:

移动应用程序在后台时的 GPS 位置(使用 ionicframework)

html - Internet Explorer 中链接上的文本阴影?

css - Font Awesome Light 通过 CSS

css - 以中心为基线的 CSS 中的左值?

android - 在 Ionic/Angular 中显示从 API 下载的 PDF

ionic-framework - 不能先隐藏 Ionic Tab

html - 来自底部的文本位置

html - 在最后一行调整 flex 元素的大小

javascript - 拖放不起作用

php - 使用 $_SERVER ['DOCUMENT_ROOT' 时 CSS 不做它的事情]