基礎CSS 嵌入 image /路徑用法

Barry YU
Feb 7, 2021

看似簡單 …..其實不容易.

但按照下面的步驟去暸解. 一切煩惱都沒了

最容易犯的錯誤就是~~路徑 :非檔案路徑的

C:\1 \2 \ 3.png — →ERRR

C: /1 /2 /3.png — → OK

Thanks give !!!

Now in the index.html.en file you'll want to put the following markup

index.html 的位置去根據每個檔案的插入圖片後的路徑

<span>src="/check_mark.png"</span>
<img src="/check_mark.png" />
<span>I'm green because I'm referenced from the ROOT directory</span>
</p>

<p>
<span>src="subfolder/check_mark.png"</span>
<img src="subfolder/check_mark.png" />
<span>I'm yellow because I'm referenced from the child of this current directory</span>
</p>

<p>
<span>src="/subfolder/check_mark.png"</span>
<img src="/subfolder/check_mark.png" />
<span>I'm orange because I'm referenced from the child of the ROOT directory</span>
</p>

<p>
<span>src="../subfolder/check_mark.png"</span>
<img src="../subfolder/check_mark.png" />
<span>I'm purple because I'm referenced from the parent of this current directory</span>
</p>

<p>
<span>src="subfolder/subfolder/check_mark.png"</span>
<img src="subfolder/subfolder/check_mark.png" />
<span>I'm [broken] because there is no subfolder two children down from this current directory</span>
</p>

<p>
<span>src="/subfolder/subfolder/check_mark.png"</span>
<img src="/subfolder/subfolder/check_mark.png" />
<span>I'm purple because I'm referenced two children down from the ROOT directory</span>
</p>

--

--