为什么在悬停链接时不用手()?
嗨,
我知道当悬停像这样的对象时可以将光标设置为手:
CSS :
cursor: hand;
cursor: pointer;
这应该使用如下所示的链接元素自动完成:
<a onclick="" class="btn1">
<span>Sök</span>
</a>
但在我的情况下不是吗?
使用 firebug,我可以看到应用了以下 CSS
<a> element
a.btn1 {
background: url("Images/Menus/bg_button_a.gif") no-repeat scroll right top transparent;
color: #444444;
display: block;
float: left;
font: 12px arial,sans-serif;
height: 24px;
margin-right: 6px;
padding-right: 18px;
text-decoration: none;
}
* {
margin: 0;
padding: 0;
}
body {
font-family: Arial,Verdana,serif;
font-size: 0.81em;
}
,
SPAN element
a.btn1 span {
background: url("Images/Menus/bg_button_span.gif") no-repeat scroll 0 0 transparent;
display: block;
line-height: 14px;
padding: 5px 0 5px 18px;
}
Controls.css (rad 80)
* {
margin: 0;
}
a.btn1 {
color: #444444;
font: 12px arial,sans-serif;
text-decoration: none;
}
body {
font-family: Arial,Verdana,serif;
font-size: 0.81em;
}
我怎样才能找到这个问题?
致以诚挚的问候
Hi,
I know that its possible to set the cusor to hand when hovering an object like this:
CSS :
cursor: hand;
cursor: pointer;
This should be done automaticly with a link element that looks like this :
<a onclick="" class="btn1">
<span>Sök</span>
</a>
But In my case its not?
With firebug I can see that the followin CSS is applyed
<a> element
a.btn1 {
background: url("Images/Menus/bg_button_a.gif") no-repeat scroll right top transparent;
color: #444444;
display: block;
float: left;
font: 12px arial,sans-serif;
height: 24px;
margin-right: 6px;
padding-right: 18px;
text-decoration: none;
}
* {
margin: 0;
padding: 0;
}
body {
font-family: Arial,Verdana,serif;
font-size: 0.81em;
}
And
SPAN element
a.btn1 span {
background: url("Images/Menus/bg_button_span.gif") no-repeat scroll 0 0 transparent;
display: block;
line-height: 14px;
padding: 5px 0 5px 18px;
}
Controls.css (rad 80)
* {
margin: 0;
}
a.btn1 {
color: #444444;
font: 12px arial,sans-serif;
text-decoration: none;
}
body {
font-family: Arial,Verdana,serif;
font-size: 0.81em;
}
How can I track down this problem?
BestRegards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果没有
href
属性,a
标记不会声明超链接。如果它拥有name
或id
属性,则它可以声明超链接的目的地。 (http://www .w3.org/TR/html4/struct/links.html#anchors-with-id)如果您要声明的元素与超链接没有语义相似性,并且您依靠 CSS 使其看起来像一、何苦呢?您也可以使用任何旧的
span
。你不应该做的是写一个{cursor:pointer; } 到您的 CSS 中,导致任何
a
元素在悬停时显示手形,即使是那些不是超链接的元素。相反,您应该像建议的那样添加href
属性。如果没有可供依赖的非 JavaScript 功能,您可以输入#
作为值。否则,您应该输入要链接到的资源的 URI。另请参阅维基百科:http://en.wikipedia.org/wiki/HTML_element#Anchor
Without the
href
attribute thea
tag does not declare a hyperlink. If it possesses aname
orid
attribute, it may declare the destination of a hyperlink instead. (http://www.w3.org/TR/html4/struct/links.html#anchors-with-id)If the element you want to declare has no semantic resemblance to a hyperlink and you are relying on CSS to make it appear like one, why bother? You might just as well use any old
span
.What you should not do is write
a { cursor:pointer; }
into your CSS, causing anya
elements to display a hand on hover, even those that are not hyperlinks. Instead you should add ahref
attribute like has been suggested. As a value you could enter#
if there is no non-JavaScript functionality to fall back on. Otherwise you should enter the URI of the resource you want to link to.See also Wikipedia: http://en.wikipedia.org/wiki/HTML_element#Anchor
那不是链接。链接具有
href
属性。这只是一个在单击时运行 JavaScript 的锚点。That's not a link. Links have
href
attributes. That's just an anchor that runs JavaScript when clicked.仅当 ANCHOR 设置了
href
属性时,手才会出现。现场演示: http://jsfiddle.net/KAEbR/
The hand appears only if the ANCHOR has a
href
attribute set.Live demo: http://jsfiddle.net/KAEbR/
这可能是因为您没有“href”值,您可以将其更改为
您还可以添加以下 css 以强制手始终显示链接:
It's likely because your doesn't have a "href" value, you could change it to
You can also add the following css to force the hand to always appear for links: