2017-05-08 29 views
-2

我刚开始学习HTML和CSS代码,并遇到以下问题。我有一个使用图像的网站链接。链接工作正常,但它也适用于下一行的其他代码。 (标题和段落) 我该如何防止这种情况?适用于不需要的其他代码行的“链接”

<a href="photographicadventures.co.uk"<a/>; 
<img src="images/w3schools.jpg" class="center" size width ="200" height="200"> 
<br> 
<br> 
<hr> 
<h2>This is a Smaller Heading.</h2> 
<p>This is a paragraph and is colored red and resized and centered due to the external style sheet </p> 

回答

1

您正试图关闭图片标记之前的定位标记。考虑在图片标签周围环绕锚标签。

此外,您的结束标记的格式不正确。所以锚点保持打开并包含文件的其余部分。你不需要分号。

下面是正确的HTML:

<a href="photographicadventures.co.uk"> 
    <img src="images/w3schools.jpg" class="center" size width ="200" height="200"> 
</a> 
<br><br><hr> 
<h2>This is a Smaller Heading.</h2> 
<p>This is a paragraph and is colored red and resized and centered due to the external style sheet</p> 
+0

感谢你的帮助,我理解你的代码,并能看到我错在哪里。 – user2894267

相关问题