html中设置图片或者文档路径,html怎么用background相对路径设置背景图片 -凯发k8官方网
相对路径就是指由这个文件所在的路径引起的跟其它文件(或文件夹)的路径关系。
1 两个文件在同一个文件夹下,直接写文件名即可
假设info.html路径是:c:\inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\inetpub\wwwroot\sites\blabla\index.html
在info.html加入index.html超链接的href应该这样写:index.html
2 要引用的文件在下一级文件夹下,文件名前加子文件夹名称
假设info.html路径是:c:\inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\inetpub\wwwroot\sites\blabla\html\tutorials\index.html
在info.html加入index.html超链接的href应该这样写:html/tutorials/index.html
3 要引用的文件在上一级文件夹下,文件名前加../
假设info.html路径是:c:\inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\inetpub\wwwroot\sites\index.html
在info.html加入index.html超链接的代码应该这样写:a href=../index.htmlindex.html/a
举一反三: ../表示源文件所在目录的上一级目录,../../表示源文件所在目录的上上级目录,以此类推。
4 更复杂的情况:
假设info.html路径是:c:\inetpub\wwwroot\sites\blabla\info.html
假设index.html路径是:c:\inetpub\wwwroot\sites\html\index.html
在info.html加入index.html超链接的代码应该这样写:a href=../html/index.htmlindex.html/a
css的例子:
如果:网页文件夹下有3.gif和themes文件夹;
themes文件夹下有css文件、1.gif和images文件夹;
images文件夹下有2.gif
那么css文件中可以写:
background:;
background:;
background:;
我自己喜欢用dreamweaver,点了url以后在对话框中选图片,免得写错。。
取消
评论
总结
以上是凯发k8官方网为你收集整理的html中设置图片或者文档路径,html怎么用background相对路径设置背景图片的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇:
- 下一篇: