2016-08-04 84 views
0

基本上我想將我的圖片置於我的名字下(在我的網站中,位於屏幕中間)當我移動圖片時,鏈接不再有效,我可以將它向左或向右移動,就像我想要的一樣,它可以工作!但上下,它不再有效?移動圖片後,HTML + CSS圖片鏈接將不起作用

HTML:

<a href="http://steamcommunity.com/id/clarkycalLad/" target="_blank"> 
    <div class="imgtest"> 
    <img src="/images/steam-icon.png" alt="HTML tutorial" style="width:42px;height:42px;border:0;"> 
    </div> 
</a> 

CSS:

.imgtest { 
    position: relative; 
    left: 800px; 
    top: 100px; 
    border: 3px solid #73AD21; 
} 
+0

沒有什麼不對,因爲寫。也許你已經把它移到了最頂端,現在還有另一個元素呢? – VoteyDisciple

+0

它很奇怪,因爲這沒有意義?我將它移到屏幕中間以下的位置.. – clarkycal

+0

由於我們無法再看到您的網頁,因此沒有真正的方法可以給出更具體的建議。 – VoteyDisciple

回答

0

修正:

z-index: 1; 

要將圖像/鏈接我的CSS部分

所以才告

.imgtest { 
    position: relative; 
    left: 800px; 
    top: 100px; 
    border: 3px solid #73AD21; 
} 

現在它:

我通過增加固定它
.imgtest { 
    position: relative; 
    left: 800px; 
    top: 100px; 
    border: 3px solid #73AD21; 
    z-index: 1; 
} 

希望這可以幫助別人! 感謝那些試圖幫助的人!

0

我剛剛得到它:它不是圖像不顯示;這不是一個鏈接。

你想這樣的:

<div class="imgtest"> 
    <a href="http://steamcommunity.com/id/clarkycalLad/" target="_blank"> 
    <img src="/images/steam-icon.png" alt="HTML tutorial" style="width:42px;height:42px;border:0;"> 
    </a> 
</div> 

否則你移動的圖像,但不是錨。

+0

沒有工作,爲你更新小提琴 – clarkycal