锚标记变成与浮动一个div非工作环节:权利; [英] Anchor tag becomes non-working link in a div with float: right;

查看:99
本文介绍了锚标记变成与浮动一个div非工作环节:权利;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有浮到屏幕右侧的div内的链接。链接不FF或Chrome工作,但在IE工程(只与IE8测试)。

I have a link inside a div that floats to the right of the screen. The link does not work in FF or Chrome, but works in IE (have only tested with IE8).

最简单的例子是这样的:

The simplest example looks like this:

<html>
<head>
<title>test</title>
<style type="text/css">
#logo {
 left:10px;
 float:left;
 top:10px;
} 
#feedback {
 float: right;
}
ul#menu
{
    position:relative;
}
ul#menu li
{
     display: inline;
     list-style: none;       
}
ul#menu li.last {
    margin-right: 50px;
}
</style>
</head>
<body>
<div class="page">
<div id="header">
    <div id="logo">logo</div>
    <div id="feedback"><a href="http://www.norge.no">test link</a></div>
    <div id="menucontainer"><ul id="menu"><li>test 1<li>test2</ul></div>
</div>
</div>

</body>

如果我删除任何浮动样式或风格的位置,链接成为Chrome和Firefox点击。 (但后来我的布局是关闭的)。

If i remove any of the float styles or position styles, the link becomes clickable in Chrome and Firefox. (but then my layout is off).

我的问题是:是什么造成这一点,是有解决它的可靠途径。

My question is: What's causing this, and is there a reliable way to solve it?

推荐答案

我以前有同样的问题。当你将鼠标悬停在锚时,光标不会更改为指针,你不能点击链接。

I've had the same problem before. When you hover over the anchor, the cursor doesn't change to the pointer, and you can't click on the link.

时,它都会一直由于重叠的锚,有效地成为鼠标和锚之间的层的定位元件。通常它是一个形象就像你。

Every time, it has been due to a positioned element that overlaps the anchor, effectively becoming a layer between the mouse and the anchor. Usually it is an image like you have.

确认该图像是不那么宽,它的边界或CSS width属性是不重叠的锚。如果这是不是这个原因,做同样的MenuContainer中。

Make sure that the image isn't so wide that it's boundary or css width property isn't overlapping the anchor. If that isn't the reason, do the same with the menucontainer.

你使用Firefox的Firebug?如果不是,它可能有助于发现任何重叠的问题。

Do you use firebug for firefox? If not, it might help discover any overlapping issues.

我有一个答案你...内的问题你为什么相对定位 UL#菜单不宣顶部,底部,左侧或右侧的属性?只是好奇。我不习惯看到那些不存在的。

I have a question within an answer for you...why are you relatively positioning the ul#menu without declaring a top,bottom,left, or right attribute? Just curious. I'm not used to seeing those not there.

这篇关于锚标记变成与浮动一个div非工作环节:权利;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆