Html css图标,您可以单击任意位置和任意大小的浏览器
我有3个可点击的图标,无论网页大小如何,我都试图让它们成为可点击的图标,它们可以全屏点击,但当我缩小屏幕时,它们就不再是可点击的了。。这是我的密码 html代码Html css图标,您可以单击任意位置和任意大小的浏览器,html,css,Html,Css,我有3个可点击的图标,无论网页大小如何,我都试图让它们成为可点击的图标,它们可以全屏点击,但当我缩小屏幕时,它们就不再是可点击的了。。这是我的密码 html代码 <a class="button twitter nohide" href="https://twitter.com/Example" target="_blank"></a> <a class="button off nohide" href="http://exampleid=12155487" tar
<a class="button twitter nohide" href="https://twitter.com/Example" target="_blank"></a>
<a class="button off nohide" href="http://exampleid=12155487" target="_blank">
</a><a class="button amazon-link nohide" href="http://www.amazon.com/gp/registry/wishlist/Example/ref=topnav_lists_1" target="_blank"></a>
在地址中包装一个span元素将使其类似于一个按钮,可以在其矩形区域中的任何位置单击。只需控制跨距的大小,因为默认情况下,跨距的宽度为0,高度为0,而跨距内没有文本
<a class="button twitter nohide" href="https://twitter.com/Example" target="_blank">
<span>
This is my link.
</span>
</a>
试试这个,看看你能得到什么
a.button {
position:absolute;
display:block;
}
a.button.amazon-link {
width:250px;
height:87px;
background:url(http://oi57.tinypic.com/24php2p.jpg);
top:0;
left:730px;
}
a.button.twitter-link {
width:250px;
height:87px;
background:url(http://oi58.tinypic.com/2n21w20.jpg);
top:0;
left:210px;
}
a.button.offtip-link {
width:250px;
height:89px;
background:url(http://oi59.tinypic.com/29c7v4i.jpg);
top:0;
left:470px;
}
#buttons.resize {
width:100%;
height:auto;
}
好吧,我弄明白了为什么当页面变小时它不起作用了,我改变了图标的位置,不管浏览器的大小,如果它在某个位置,图标都会起作用,但是如果我在浏览器上再向左移动图标,那么只有当它们在浏览器的最右侧时,它们才不再可以在该区域单击?有什么理想吗?可能很傻,但是。。。某些透明元素可能正在阻止它们。像一个div什么的。真的。。欣赏它“target=“\u blank”>“target=“\u blank”>
在不可点击链接上执行inspect元素将确认它是否确实被div或其他东西阻止。在chrome中,右键单击它并选择“检查元素”。将出现一个小框,显示页面的html。其中一部分将突出显示。如果突出显示的文本不是您的地址,那么它确实被阻止了。这通常是因为绝对定位。
a.button {
position:absolute;
display:block;
}
a.button.amazon-link {
width:250px;
height:87px;
background:url(http://oi57.tinypic.com/24php2p.jpg);
top:0;
left:730px;
}
a.button.twitter-link {
width:250px;
height:87px;
background:url(http://oi58.tinypic.com/2n21w20.jpg);
top:0;
left:210px;
}
a.button.offtip-link {
width:250px;
height:89px;
background:url(http://oi59.tinypic.com/29c7v4i.jpg);
top:0;
left:470px;
}
#buttons.resize {
width:100%;
height:auto;
}