关于 href 的简单 HTML 问题

发布于 2024-09-01 02:26:38 字数 1574 浏览 8 评论 0原文

我正在尝试创建超链接到某些 URL 的图像,但超链接似乎不起作用。

我正在使用下面给出的代码 http://windchimes.co.in/ index_w%20-%20Copy.html

你能告诉我为什么图标的超链接不起作用吗?

<td width="29" style="padding-bottom: 42px;><a href="http://windchimes.co.in/blog" target="_blank"><img align="middle" title="blog" alt="blog" src="http://dl.dropbox.com/u/529534/windchimes/icon-blog.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.linkedin.com/groups?gid=120310" target="_blank"><img align="middle" title="linkedin" alt="linkedin" src="http://dl.dropbox.com/u/529534/windchimes/icon-linkedin.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.facebook.com/group.php?gid=72425590275" target="_blank"><img align="middle" title="facebook" alt="facebook" src="http://dl.dropbox.com/u/529534/windchimes/icon-facebook.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://twitter.com/windchimesindia" target="_blank"><img align="middle" title="twitter" alt="twitter" src="http://dl.dropbox.com/u/529534/windchimes/icon-twitter.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.youtube.com/user/Windchimesindia" target="_blank"><img align="middle" title="Youtube" alt="Youtube" src="http://dl.dropbox.com/u/529534/windchimes/icon-youtube.gif"></a><td>

I am trying to create images hyperlinked to some URL's and hyperlinks donot seem to work.

I am using the code as given below at http://windchimes.co.in/index_w%20-%20Copy.html

Can you tell me why the hyperlinks to the icons are not workking?

<td width="29" style="padding-bottom: 42px;><a href="http://windchimes.co.in/blog" target="_blank"><img align="middle" title="blog" alt="blog" src="http://dl.dropbox.com/u/529534/windchimes/icon-blog.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.linkedin.com/groups?gid=120310" target="_blank"><img align="middle" title="linkedin" alt="linkedin" src="http://dl.dropbox.com/u/529534/windchimes/icon-linkedin.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.facebook.com/group.php?gid=72425590275" target="_blank"><img align="middle" title="facebook" alt="facebook" src="http://dl.dropbox.com/u/529534/windchimes/icon-facebook.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://twitter.com/windchimesindia" target="_blank"><img align="middle" title="twitter" alt="twitter" src="http://dl.dropbox.com/u/529534/windchimes/icon-twitter.gif"></a></td><td width="29" style="padding-bottom: 42px;> <a href="http://www.youtube.com/user/Windchimesindia" target="_blank"><img align="middle" title="Youtube" alt="Youtube" src="http://dl.dropbox.com/u/529534/windchimes/icon-youtube.gif"></a><td>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萧瑟寒风 2024-09-08 02:26:38

不知道是否还有更多,但您错过了以下位置的结束引号:

 <td width="29" style="padding-bottom: 42px;>
                                          ^^^

Don't know if there is more, but you're missing the closing quotes at:

 <td width="29" style="padding-bottom: 42px;>
                                          ^^^
花开柳相依 2024-09-08 02:26:38

如果执行以下操作,诊断、维护和调整网页会容易得多。

  1. 将您的关注点分开 - 您的 HTML 应该描述文档,而不是其样式。将您的样式规则放入级联样式表(CSS)中,这也意味着您将满足下一个规则
  2. 不要重复自己。所有这些元素的宽度和样式规则都完全相同。这意味着如果你想将宽度更改为 30px,你必须查找/替换这些项目中的每一个(如果你自动化查找和替换,你必须希望你不会意外地替换你不想要的东西布局
  3. 您的代码 - 通过正确地标记您的 HTML 代码,您将发现诸如缺少结束标记之类的错误,因为它会立即看起来错误
  4. - 这将发现错误 。您将帮助您避免代码中的两个问题 - 缺少引号和缺少结束标记。

这是代码的干净版本...

CSS:

td.myClass {
    width: 29px;
    padding-bottom: 42px;
    text-align: center;
}

和 HTML:

<td style="myClass">
    <a href="http://windchimes.co.in/blog" target="_blank">
        <img title="blog" alt="blog" src="http://dl.dropbox.com/u/529534/windchimes/icon-blog.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://www.linkedin.com/groups?gid=120310" target="_blank">
        <img title="linkedin" alt="linkedin" src="http://dl.dropbox.com/u/529534/windchimes/icon-linkedin.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://www.facebook.com/group.php?gid=72425590275" target="_blank">
        <img title="facebook" alt="facebook" src="http://dl.dropbox.com/u/529534/windchimes/icon-facebook.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://twitter.com/windchimesindia" target="_blank">
        <img title="twitter" alt="twitter" src="http://dl.dropbox.com/u/529534/windchimes/icon-twitter.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://www.youtube.com/user/Windchimesindia" target="_blank">
        <img title="Youtube" alt="Youtube" src="http://dl.dropbox.com/u/529534/windchimes/icon-youtube.gif">
    </a>
</td>

It is much easier to diagnose, maintain and adjust your web pages if you do the following.

  1. Keep your concerns separated - your HTML should describe a document, not its style. Put your style rules into a cascading style sheet (CSS), which will also mean you'll satisfy the next rule
  2. Don't repeat yourself. You had a width and style rule on all of these elements that was exactly the same. That means if you want to change the width to 30px, you'd have to find / replace each of these items (and if you automate your find and replace, you have to hope you don't accidentally replace something you didn't mean to.
  3. Layout your code - by properly tabbing your HTML code, you will spot errors like missing closing tags as it will instantly look wrong to the eye.
  4. Use validator.w3.org to make sure the code is correct - this will spot errors for you and will help you avoid the two problems in your code - a missing quote and a missing closing tag.

Here is a clean version of your code...

CSS:

td.myClass {
    width: 29px;
    padding-bottom: 42px;
    text-align: center;
}

And HTML:

<td style="myClass">
    <a href="http://windchimes.co.in/blog" target="_blank">
        <img title="blog" alt="blog" src="http://dl.dropbox.com/u/529534/windchimes/icon-blog.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://www.linkedin.com/groups?gid=120310" target="_blank">
        <img title="linkedin" alt="linkedin" src="http://dl.dropbox.com/u/529534/windchimes/icon-linkedin.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://www.facebook.com/group.php?gid=72425590275" target="_blank">
        <img title="facebook" alt="facebook" src="http://dl.dropbox.com/u/529534/windchimes/icon-facebook.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://twitter.com/windchimesindia" target="_blank">
        <img title="twitter" alt="twitter" src="http://dl.dropbox.com/u/529534/windchimes/icon-twitter.gif">
    </a>
</td>
<td style="myClass">
    <a href="http://www.youtube.com/user/Windchimesindia" target="_blank">
        <img title="Youtube" alt="Youtube" src="http://dl.dropbox.com/u/529534/windchimes/icon-youtube.gif">
    </a>
</td>
浴红衣 2024-09-08 02:26:38

一个好主意是通过 W3 验证器 运行代码:

http: //validator.w3.org/check?uri=http://windchimes.co.in/index_w%2520-%2520Copy.html

它会告诉您 HTML 在哪些方面存在格式错误。

A good idea is to run your code through the W3 Validator:

http://validator.w3.org/check?uri=http://windchimes.co.in/index_w%2520-%2520Copy.html

It will tell you in what ways your HTML is malformed.

水染的天色ゝ 2024-09-08 02:26:38

您的最后一个 标记也未正确关闭。

<td width="29" style="padding-bottom: 42px;>
...
<td>

末尾应为 而不是

Your last <td> tag isn't properly closed, either.

<td width="29" style="padding-bottom: 42px;>
...
<td>

should be </td> instead of <td> at the end.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文