CSS:为什么当我取出 Overflow:hidden 时会出现这种情况?
因此,在类导航中,当我有溢出:隐藏时,那里有中心并且效果很好,但我不能使用溢出:隐藏,因为它会隐藏导航中的下拉菜单。
但是当我把它拿出来的时候,它就碎了?除了overflow:hidden之外,我还能使用什么来保持它看起来正确,并且不隐藏我的导航?
So in the class nav, when i have overflow:hidden in there is centers and works well, but i can't use overflow:hidden because it will hide my drop downs in the navigation.
But when i take it out, it breaks it? What else can I use other than overflow:hidden to keep it looking right, and not hide my navigation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需设置
.nav
的高度(35px?)并删除overflow: hide;
Just set the height (35px?) of
.nav
and remove theoverflow: hidden;
它导致overlfow隐藏清除所有浮动并赋予元素浮动li的高度。解决方案是这样的: http://jsfiddle.net/svr8C/11/
这条语句:
添加一个lis 之后的不可见元素并清除它们。它取自著名的 oocss 媒体元素:https://github。 com/stubbornella/oocss/blob/master/core/media/media.css
Its cause the overlfow hidden clear all the float and gives the element the height of the floating li. The solution is this: http://jsfiddle.net/svr8C/11/
This statement:
adds an invisible element after the lis and clear them. Its taken from the famous oocss media element: https://github.com/stubbornella/oocss/blob/master/core/media/media.css
尝试溢出:自动; - 这将清除浮动,类似于溢出:隐藏;但如果你不小心,可能会引入滚动条。或者,您可以尝试“全部浮动”方法:另一个浮动元素内的浮动元素也会强制清除浮动。
Try overflow: auto; - this will clear the float similarly to overflow: hidden; but may introduce scrollbars instead if you're not careful. Alternatively you can try a "float all" approach: a floated element inside another floated element also forces float clearing.
您可以使用此类内容。
HTML:
CSS:
这是演示
You can user something of this sort.
HTML:
CSS:
Here is the demo