首页 >web前端 >html教程 >img 的 src 要怎么写_html/css_WEB-ITnose

img 的 src 要怎么写_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-21 09:24:34989浏览

exe在最下面的 Debug 中,
main中执行chdir 切到了BS目录
在html/index.html 中想使用resouce下的一个jpg 要怎么写相对路径?


回复讨论(解决方案)

相对路径:假定你当前路径是 html/index.html  (html 对应你目录的 html)
src = "../resource/xxx.jpg";

话说你用这么高深的东西了 相对路径不会弄?

相对路径:假定你当前路径是 html/index.html  (html 对应你目录的 html)
src = "../resource/xxx.jpg";

话说你用这么高深的东西了 相对路径不会弄?



<!DOCTYPE html><html><head></head><body bgcolor="black"><p><img  src="/static/imghwm/default1.png"  data-src="resource/chick1.jpg"  class="lazy"     / alt="img 的 src 要怎么写_html/css_WEB-ITnose" ></p><p><img  src="/static/imghwm/default1.png"  data-src="../resource/chick1.jpg"  class="lazy"     / alt="img 的 src 要怎么写_html/css_WEB-ITnose" ></p><p><img  src="/static/imghwm/default1.png"  data-src="../../resource/chick1.jpg"  class="lazy"     / alt="img 的 src 要怎么写_html/css_WEB-ITnose" ></p><p><img  src="/static/imghwm/default1.png"  data-src="../../../resource/chick1.jpg"  class="lazy"     / alt="img 的 src 要怎么写_html/css_WEB-ITnose" ></p><p><img  src="/static/imghwm/default1.png"  data-src="../../../../resource/chick1.jpg"  class="lazy"     / alt="img 的 src 要怎么写_html/css_WEB-ITnose" ></p><script></script></body></html>


我两个试了各种路径, 都没有用,

Resource interpreted as Image but transferred with MIME type text/html: "http://localhost:50000/resource/chick1.jpg".

这是 chrome console  的打印



文件是没有问题的哦 

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn