我刚刚开始学习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>
您正在尝试关闭图像标记之前的锚标记。 考虑将锚标记包裹在图像标记周围。
此外,结束标签的格式不正确。因此,定位点保持打开状态,并包含文件的其余部分。 您不需要分号。
这是正确的 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>