CSS - 帮助我设置此菜单的样式而不使用边距?
我正在创建一个网站,当鼠标悬停在菜单上时,我遇到了巨大的 IE 延迟。 我正在组合使用 Cufon,当我将高度、宽度、边距或填充应用于 li:hover 元素时,它似乎会导致巨大的滞后。
所以,我需要找出一种聪明的方法来做到这一点。 网站在这里,http://w3box.com/mat
我想你可以清楚地看到菜单。 所以,我想要的是将整个菜单向下推,使其位于高度线底部上方 3 或 4 个像素处。因此它与左侧徽标字体的垂直位置大致相同。
然后,我希望悬停效果的高度更大。很难解释,但是当将鼠标悬停在菜单项上时,想象一个框,其中文本位于框的最底部。像这样;
http://img710.imageshack.us/img710/2791/menuheader.jpg
现在,您可能会注意到箭头看起来像粘在底部的东西。我真的不需要这个,但如果您知道如何做到这一点,我将不胜感激! ;)
I'm creating a site where I've encountered a huge IE lag when hovering over the menus.
I'm using Cufon in combination and it seems like it's causing a huge lag when I apply height, width, margins or paddings to the li:hover element.
So, I need to figure out a smart way of doing this otherwise.
The site is here, http://w3box.com/mat
You can clearly see the menu I guess.
So, what I want is to push the entire menu downwards so it's like 3 or 4 pixels above the bottom of the height line. So it matches about the same vertical position as the logo font to the left.
Then, I want the hover effect to be larger in height. Hard to explain, but when hovering over a menu item, imagine a box where the text is positioned at the very bottom of the box. Like this;
http://img710.imageshack.us/img710/2791/menuheader.jpg
Now, you may notice the arrow looking thingy sticking at the bottom. I don't really need that, but if you have any idea on how to do it, I'd appreciate the help! ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我没有尝试过,但我认为这可能是一个选择。
你把所有东西都放在一个 div 中,为什么不尝试将 div 放在 div 中呢?
这是您当前的标题代码。
您可以尝试这样的操作,这样您就可以更好地控制不同的对象。
我不确定这可能是正确的组合,但我认为通过 div 内的三个 div,您将获得对标题 div 内的元素的更多控制。
I have not tried, but I think this may be an option.
You have everything with in one div, why dont you try to put div with in divs?
this is your current code for header.
You can try something like this, so you have more control over the different objects.
I am not sure that may be the right combination, but I think with the three divs inside the div you will gain more control over the elements inside the header div.
省略菜单中的 h4,因为我认为不需要它。比在
上设置
display:block
并使用line-height
和padding-left 、 padding-right
使锚点展开合适的尺寸。另请注意,如果不进行一些调整,IE6/7 中不支持 li:hover。要将菜单定位在与徽标相同的级别,只需在 ul 元素上设置margin-top
即可。Omit the h4 in the menu since i think it is not needed. Than set
display:block
on<a>
and useline-height
andpadding-left , padding-right
to make the anchor expand the right size. Also notice that li:hover is not supported in IE6/7 without some tweaks. To position the menu on same level as logo just set amargin-top
on ul element.对我来说有太多的规则,太多无用的规则。
没有时间纠正所有问题并在 FF/IE 上测试它,但这适用于示例:
.menuwrapper li {
浮动:右;
列表样式:无;
内边距:30px 23px 3px 23px;
位置:相对;
顶部:7 像素;
}
There're too many rules for me, too many useless rules.
Don't have the time to correct all and test it on FF/IE, but this works ofr example :
.menuwrapper li {
float:right;
list-style: none;
padding: 30px 23px 3px 23px;
position: relative;
top: 7px;
}
垂直对齐怎么样?
What about vertical-align?