2017-09-16 26 views
0

我想建立一個頁面,其中包含4個圖像,有一個絕對的,然後每個其他3個是相對的,並重定向到另一個頁面,問題是我想讓他們互相平行,所以我使用填充左側和頂部調整我需要的位置img,但主要的問題是我可以重定向到任何頁面按此填充的任何位置,如附加的屏幕截圖。 我真的想讓img只能重新引導到另一個頁面,而不是所有這些空間。如何調整另一圖像上的圖像以使用html重定向到另一個頁面?

enter image description here

我寫了這個代碼

<div> 
    <img src="./assets/Images/Rectangle 1.png" style="position: absolute;" alt="Main Design" width="100%"> 
    <a href="https://www.w3schools.com"> 
    <img src="./assets/Images/Account.png" style="position: relative; padding-left: 180px; padding-top: 220px;" alt="Accounts Management"> 
    </a> 
    <a href="https://www.w3schools.com"> 
    <img src="./assets/Images/Bus.png" style="position: relative; padding-left: 150px; padding-top: 220px;" alt="Bus Management"> 
    </a> 
    <a href="https://www.w3schools.com"> 
    <img src="./assets/Images/Line.png" style="position: relative; padding-left: 150px; padding-top: 220px;" alt="Line Management"> 
    </a> 

對於如何解決這個任何建議?

回答

1

你是否嘗試在錨元素上使用margin屬性?

我認爲你可以使用margin-(上,左,右,底部)進入正確的位置,也可能是其他屬性,這樣anchor元素中的唯一內容將是圖像而不是填充空格。

類似:

<div> 
    <img src="./assets/Images/Rectangle 1.png" style="position: absolute;" alt="Main Design" width="100%"> 
    <a href="https://www.w3schools.com" style="position: relative; margin-left: 180px; margin-top: 220px;"> 
    <img src="./assets/Images/Account.png" style="position: relative;" alt="Accounts Management"> 
    </a> 
    <a href="https://www.w3schools.com" style="position: relative; margin-left: 150px; margin-top: 220px;"> 
    <img src="./assets/Images/Bus.png" style="position: relative; " alt="Bus Management"> 
    </a> 
    <a href="https://www.w3schools.com" style="position: relative; margin-left: 150px; margin-top: 220px;"> 
    <img src="./assets/Images/Line.png" style="position: relative;" alt="Line Management"> 
    </a> 
</div> 
+0

哦謝謝,它的工作原理:) –

相關問題