右对齐 Superfish 菜单 - 并阻止它跳来跳去
我真的很想阻止菜单项在在此网站上跳跃,因为父项会扩展以适合其子项。
当我添加这个 CSS 时,我可以让它看起来像我想要的那样,强制菜单项具有固定宽度:
/*Menu item 1*/
#menu-item-117 .sub-menu {right: -125px;}
/*Menu item 2*/
#menu-item-73 {width:45px;}
#menu-item-73 .sub-menu {width:980px!important;right: -10px;}
/*Menu item 3*/
#menu-item-122 {width:65px;}
#menu-item-122 .sub-menu{width:980px!important;right: 165px;}
但是,这显然不理想,因为菜单需要是动态的......
有没有办法实现我想要的通过CSS?我希望如此!
我正在使用 WordPress Theme Hybrid 附带的 Superfish 菜单。
预先感谢您提供的任何帮助!
I would really like to stop the menu items jumping around on this site as the parent item expands to fit its child.
I can get it looking how I want when I add this CSS, forcing the menu items to have fixed widths:
/*Menu item 1*/
#menu-item-117 .sub-menu {right: -125px;}
/*Menu item 2*/
#menu-item-73 {width:45px;}
#menu-item-73 .sub-menu {width:980px!important;right: -10px;}
/*Menu item 3*/
#menu-item-122 {width:65px;}
#menu-item-122 .sub-menu{width:980px!important;right: 165px;}
However, this is clearly not ideal, as the menu needs to be dynamic...
Is there a way to achieve what I want via CSS? I hope so!
I am using the Superfish menu that comes with Theme Hybrid for Wordpress.
Thanks in advance for any help you can offer!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我明白你的意思..让我们再看看。
此构建使用
position:relative/absolute;
而不是float: right/left;
并且它有一个下面提到的缺陷。不过,我还没有在包括 IE 在内的旧浏览器中对此进行测试(在 Chrome 和 Firefox 中进行了测试),但我希望这可以为您提供一些实现它的想法。 :)
I get your point .. let's see again.
This build uses
position: relative/absolute;
instead offloat: right/left;
and it has one flaw mentioned below.However I haven't test this in old browsers including IE (tested in Chrome & Firefox), but I hope this may provide you some idea to implement it. :)