CSS 菜单的顺序很奇怪
我有一个关于有点奇怪的 css 菜单的问题。我需要什么:
- 三个级别
- 第一级别必须是水平的
- 第二级别必须位于第一级别的顶部并且垂直
- 第三级别必须位于第一级别的底部并且水平
它应该看起来像这样(忘记了第四级别):
...
B.1.2
B.1.1
A B C D E ...
B.2.1 B.2.2 ....
B.3.1
B.3.2
...
您对如何为此构建跨浏览器菜单有什么想法吗?
I have a question about a little strange css menu. What i need:
- Three levels
- First level must be horizontal
- Second level must be on top of the first and in vertical
- Thire level must be bottom to the first on and in horizontal
It should looks like that (forgott the forth level):
...
B.1.2
B.1.1
A B C D E ...
B.2.1 B.2.2 ....
B.3.1
B.3.2
...
Do you have any ideas how to build a cross browser menu for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在CSS中尝试了一下: http://jsfiddle.net/c8tKC/6/
正如你可以看到使用 :hover 选择器到达第三级存在问题。您可能想使用 onClick 事件切换显示属性。
I gave it a try in CSS: http://jsfiddle.net/c8tKC/6/
As you can see there is a problem to reach the third level with :hover selectors. You might want to toggle the display attribute using the onClick event.
这是我在过去几分钟内所做的事情: http://jsfiddle.net/DUfUn/1/
但这非常糟糕,因为两个值取决于第一个子菜单中的项目数量。这必须动态生成。但无论如何,如果您使用 PHP 脚本填充菜单,也并非不可能。我评论了相应的值。
也许这是一个基础,有人可以扩展它,使其变得更加动态。
Here is something I did in the past minutes: http://jsfiddle.net/DUfUn/1/
It is pretty bad though, as two values depend on the count of items in the first submenu. This would have to be dynamically generated. But not impossible, if you fill the menu with a PHP script anyway. I commented the corresponding values.
Maybe this works as a basis and someone can extend it so that it becomes more dynamic.