HTML - 从子文件夹中选择根文件夹的图像 [英] HTML - pick images of Root Folder from Sub-Folder

查看:179
本文介绍了HTML - 从子文件夹中选择根文件夹的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我网站的 DIR 结构



现在在 index.html 我可以简单地参考像

 < img src =./ images / logo.png> 

但是如果我想引用相同的图像fron sub.html src

解决方案

 < img src =../ images / logo.png> 
__ ______ ________
| | |
| | | ___ 3.获取名为logo.png
|的文件|
| | ___ 2.进入images /子目录
|
|
| ____ 1.向上一级


lets say following is the DIR structure of my website

Now in index.html i can simply refer images like

<img src="./images/logo.png">

but what if i want to refer the same image fron sub.html what will be the src

解决方案

<img src="../images/logo.png">
          __ ______ ________
          |    |       |
          |    |       |___ 3. Get the file named "logo.png"
          |    |
          |    |___ 2. Go inside "images/" subdirectory
          | 
          | 
          |____ 1. Go one level up

这篇关于HTML - 从子文件夹中选择根文件夹的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆