HTML超链接失败:编码冲突?

时间:2018-07-26 15:33:55

标签: html css

在过去的一周中,我一直在通过基本教程学习HTML和CSS,并且一直在尝试重新创建我几年前使用Squarespace(简单的构建器)创建的网站。昨天,我无法向图像添加链接,但是通过添加div标签实现了此目的,其余链接现在不起作用。我的编码中有冲突吗?在这里:

4
<style type="text/css">
		body {background-image: url(THX1138.jpg);
			background-size: cover; background-position: inherit}
		h1 {text-transform: uppercase;height:70%;width: 100%; display: flex; position: fixed; align-items: center;justify-content: center; font-family: helvetica}
		table {text-transform: lowercase;height:90%;width: 100%; display: flex; position: fixed; align-items: center;justify-content: center; font-family: monospace;}
		a:link{text-decoration: none; margin: 2px; color: black;}
		a:visited{color:black}
		a:hover{background-color: #f7d8d8; padding: 3px;
			-o-transition:color .2s ease-out, background .3s ease-in;
			-ms-transition:color .2s ease-out, background .3s ease-in;
			-moz-transition:color .2s ease-out, background .3s ease-in;
			-webkit-transition:color .2s ease-out, background .3s ease-in;}
		#twitterbird {height: 102%; width: 100%;display:flex;position:fixed;align-items: center;justify-content: center;}
		
	</style>

任何人和所有帮助都将不胜感激!

编辑:我知道href位于TD的错误一侧。我只是在四处寻找解决方法,却忘了改回来。认为问题在于div覆盖了其他链接,但是我需要div才能将img放置在正确的位置并使img上的链接正常工作。有什么想法吗?

编辑2:弄清楚了。我误解了div的实际含义。使用高度和宽度,我正在更改div的大小,而不是其位置,而我没有意识到。我所需要的只是上下命令。感谢您的所有评论!

4 个答案:

答案 0 :(得分:1)

您的col_2 == 1标记不应位于new_col 3 3 4,5 标记之外,而应位于内部。

a

答案 1 :(得分:1)

我认为您犯了急急的错误。在下面更改您的代码。

<table>
<tr>
<td> <a href="index%202.html"> About Us</a></td>
<tr>
</table>

答案 2 :(得分:0)

你有

<tr>
    <a href="index.html"><td> Reviews</td></a>
    <a href="index%203.html"><td> Features</td></a>
    <a href="index%202.html"><td> About Us</td></a>
</tr>

您应该拥有

<tr>
    <td><a href="index.html">Reviews</a></td>
    <td><a href="index%203.html">Features</a></td>
    <td><a href="index%202.html">About Us</a></td>
</tr>

答案 3 :(得分:0)

问题是您已将#twitterbird div设置为覆盖整个页面。链接 正常工作,但是相关的div掩盖了它们,因此鼠标无法“获取”链接。

正如其他张贴者所指出的,您还需要将<a>标签移到<td>标签内。