圆形 CSS 选项卡
我使用 CSS 创建了一些圆形导航选项卡,但在实现 hover
时遇到了麻烦。
首先,这是网站 Tabs 的链接,因为它很难解释。 请将鼠标悬停在选项卡的左侧以了解我的问题。 我已经在下面解释过。
我在 #navigation li
项目上设置了一个背景图像,其中包含左侧角,然后我有第二个背景图像(右侧角),这是使用 #navigation a
设置的>。
但是,当我将鼠标悬停在选项卡左侧时,只显示一小块背景,我认为这是因为只有 li 区域悬停在上面。 显然,我希望整个选项卡突出显示,就像将鼠标悬停在其余部分上时一样。
这很难解释,所以如果您需要进一步询问我以了解问题,请这样做。
I have created some rounded navigation tabs using CSS and am having trouble when implementingn hover
.
Firstly here is a link to the site Tabs as it is quite difficult to explain.
Please, hover over the left side of the tabs to understand my problem. I have explained below.
I have a background image set on #navigation li
items this contains the left side corner and I then have a second background image (the right corner) this is set using #navigation a
.
However when I hover over the left side of the tab, only a small piece of background is shown, I presume this is because only the li area is being hovered over. Obviously I would like the entire tab to highlight as it does when you hover over the rest of it.
This was quite hard to explain so if you need to question me further to understand the problem please do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
几件事:
通过去掉
现在你有一个不同的问题,左角不显示。 通过将
a
和a:hover
的背景颜色设置为transparent
而不是颜色来解决此问题 - 现在最后,我建议您将行为从完全另一个图像更改为具有不同背景位置的同一图像,以便翻转加载不可见。
编辑:没有图像交换的CSS翻转此处描述
Couple of things:
Fix the problem by taking the padding off the <li> and putting it back on the child <a> - the space they occupy needs to be the same to get the hovers to align.
Now you have a different problem, the left corner doesn't show. Fix this by making the background colour for the
a
anda:hover
equal totransparent
instead of the colours - now the <li> can show through.Finally, I suggest you change the behaviour from being another image entirely, to the same image with a different background-position, so the rollover loads invisibly.
edit: css rollover without image swap described here
使用 jQuery,一切都变得非常简单!
但您甚至可以尝试可缩放框:
http://www.usabilitypost.com/2008/11/27/scalable-content-box-using-only-one-background-image/
,然后更改悬停时的背景图像。
With jQuery it's super easy!
but you can even try scalable box:
http://www.usabilitypost.com/2008/11/27/scalable-content-box-using-only-one-background-image/
and then change the background image on hover.
或者您可以将 li:hover 和 a:hover 替换为以下内容:
请注意,它可能不适用于 IE6。
Or you can replace your li:hover and a:hover with these:
Note that it may not work IE6.