京東店鋪裝修裡所說的「耳朵」,指的是頁面側邊那塊固定在旁邊的圖文區塊。做法其實就是一個表格,把幾張圖各自包上連結,再用外層 div 控制寬度與位置。
<div class="w w1">
<div>
<div>
<table id="Table_01" width="139" height="492" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<a href="https://mall.jd.com/index-24636.html" target="_blank">
<img src="你的圖片網址-1.jpg" alt="" width="139" height="74" border="0" />
</a>
<a href="https://item.jd.com/1020652628.html" target="_blank">
<img src="你的圖片網址-2.jpg" alt="" width="139" height="176" border="0" />
</a>
</td>
</tr>
<tr>
<td>
<a href="https://item.jd.com/1008115682.html" target="_blank">
<img src="你的圖片網址-3.jpg" alt="" width="139" height="190" border="0" />
</a>
</td>
</tr>
<tr>
<td>
<a href="https://mall.jd.com/index-24636.html" target="_blank">
<img src="你的圖片網址-4.jpg" alt="" width="139" height="52" border="0" />
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
border="0" 與 cellspacing="0":少了這兩個屬性,圖片之間會出現難看的接縫與藍色框線。順帶一提,用 table 做排版並不是好習慣——它本是為了呈現表格資料而存在的。若要在自己的網站上做側邊浮動區塊,用 position: fixed 搭配 display: flex 會乾淨得多,也不需要靠一堆嵌套的 div 去模擬定位。