滑动门 CSS 菜单问题...
所以我正在尝试做一个滑动门 CSS 菜单——基本上是一张图像,当它悬停或处于活动状态时,您可以在其上移动背景位置。
但是,通常当我使用以下方法移动到下一个链接时:
#xmenu li.ypart {width:80px; height:35px;}
#xmenu li.ypart a {background-position:-33px 0px; }
它从最后一个链接到我指定的任何宽度。看到下图中的地图图标了吗?我正在尝试链接它,以便该链接不会一直从“发送反馈”链接到地图按钮。我只是希望链接是那个正方形。
有什么想法吗?
So I'm trying to do a sliding door CSS menu -- basically one image that you move the background position on when it's hovered or when it's active.
However, usually when I move to the next link using:
#xmenu li.ypart {width:80px; height:35px;}
#xmenu li.ypart a {background-position:-33px 0px; }
It takes from the last link to whatever width I specify. See the MAP icon on the image below? I'm trying to link it so that the link doesn't go all the way from the SEND FEEDBACK link to the map button. I just want the link to be that square.
So any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确,您应该将链接(
元素)设置为块元素,并为其指定特定的宽度和高度(可能还包括相对/绝对定位,具体取决于您的布局方式)设置)。这样,链接的点击区域将被限制在这些尺寸内。
标记是这样的:
CSS 也是这样:
If I understand correctly, you should make the link (the
<a>
element) a block element and give it a specific width and height (and maybe relative/absolute positioning, depending on how your layout is set up). That way, the hit area for the link will be confined to those dimensions.Something like this for the markup:
And something like this for the CSS: