2016-01-06 38 views
0

Iam製作一個網站使用div標籤和css圍繞文本和圖像做一個盒子。這些圖像用於超鏈接,因爲這是一個遊戲網站。但是div標籤中的代碼不起作用,但在div標籤之外工作。請給我一個可行的代碼。如何在div標籤內製作超鏈接圖片?

我的代碼:

<div style="width:825px;height:300px;border:15px solid black;background-color:lightgrey;padding: 25px;margin: 25px;> 
    <A HREF="http://www.test-joey-spellen.byethost4.com/Games/arcade.html"> 
     <IMG BORDER="0" SRC="images/arcade.jpeg" width="130" height="85"> 
    </A> 
</div> 

回答

1

你已經在第一行的最後錯過了報價。

取而代之的是,

<div style="width:825px;height:300px;border:15px solid black;background-color:lightgrey;padding: 25px;margin: 25px;> 

這樣做:

<div style="width:825px;height:300px;border:15px solid black;background-color:lightgrey;padding: 25px;margin: 25px;"> 
1
<div style="width:825px;height:300px;border:15px solid black;background-color:lightgrey;padding: 25px;margin: 25px;"> 
<a href="http://www.test-joey-spellen.byethost4.com/Games/arcade.html"> 
<img border="0" src="images/arcade.jpeg" width="130" height="85"> 
</a> 
</div> 

你的代碼是缺少右雙引號的 「風格」。另外嘗試使用外部的CSS文件,並在該文件中包含所有的CSS。不要使用「CAPSLOCK」寫HTML標籤。

0

你的風格mistack屬性不會關閉quote

更改您的HTML

<div style="width:825px;height:300px;border:15px solid black;background-color:lightgrey;padding: 25px;margin: 25px;"><a href="http://www.test-joey-spellen.byethost4.com/Games/arcade.html"><img border="0" src="images/arcade.jpeg" width="130" height="85"></a> 
</div> 
0

使用以下code.are你的風格屬性錯不關閉引號(「)

<a href="http://www.test-joey-spellen.byethost4.com/Games/arcade.html"> 
<div style="width:825px;height:300px;border:15px solid black;background-color:lightgrey;padding: 25px;margin: 25px;"> 
<IMG BORDER="0" SRC="images/arcade.jpeg" width="130" height="85"> 
</div> 
</a>