href位置不起作用

时间:2014-04-11 17:45:47

标签: javascript html

在我的网站标题http://thetrashedvintage.com/上我使用:

<div class="collections" onclick="location.href='http://thetrashedvintage.com/wool-collection';" style="cursor: pointer;">
                <img src="http://www.thetrashedvintage.com/collections.jpg" alt="Collections" />
                </div>

让div可点击,但是当我点击它重定向到其他地方时,当我点击Collections时,它会将我重定向到Login,下一个div,我做错了什么想法?

感谢您的帮助!

3 个答案:

答案 0 :(得分:0)

尝试将你的div放在像这样的

<a href="location where your stuff is"><div class="collections" style="cursor: pointer;"> <img src="http://www.thetrashedvintage.com/collections.jpg" alt="Collections" />
</div></a>

答案 1 :(得分:0)

您的收藏夹div与您的登录div重叠

要解决此问题,

更改您的CSS
div.login {
  width: 50%;
  right: -130px;
}

div.login {
  /*width: 50%; <-- REMOVE THIS */
  right: 115px;
}

答案 2 :(得分:0)

你的CSS错了。如果您有FireFox使用Inspector,请按Ctrl + Shift + C并在登录时使用鼠标转到并查看边距div登录(重叠集合)并转到更多左边有边距集合。固定位置的CSS是个坏主意。

对不起我有趣的英语。

相关问题