【问题标题】:A "link" that works on unwanted other lines of code适用于不需要的其他代码行的“链接”
【发布时间】:2017-10-06 14:48:45
【问题描述】:

我刚开始学习 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 css image href


    【解决方案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>
    

    【讨论】:

    • 感谢您的帮助,我了解您的代码并且可以看到我哪里出错了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-08
    • 2021-10-09
    • 1970-01-01
    • 2016-01-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多