使UL比它的父母LI更宽 [英] Making a UL wider than it's parent LI

查看:246
本文介绍了使UL比它的父母LI更宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有下拉菜单的导航栏,我想下拉菜单伸展到它内部的内容所需的任何宽度,但它们只会像父元素一样宽。

I have a nav bar with dropdown menus, I would like the dropdown menus to stretch to whatever width necessary for the content inside it, but they will only go as wide as their parent element

我已经阅读了很多,大多数人建议在下拉菜单中设置位置:绝对。我已经这样做了,它不会影响它

I've read quite a bit on this, and most people suggest setting position:absolute on the dropdown menus. I've already done this and it doesn't effect it

我的jsFiddle在这里: http://jsfiddle.net/Rqgh6/

My jsFiddle is here: http://jsfiddle.net/Rqgh6/

有没有人知道如何让下拉列表比他们的父级元素

Does anyone know how I can get it the dropdowns to go wider than their parent element?

推荐答案

您可以直接添加 white-space:nowrap; < a> 元素:

You can simply add white-space:nowrap; to the <a> elements:

.menu ul a {font-size:12px;padding:0 10px;line-height:22px;text-align:left; white-space:nowrap;}

已更新 jsFiddle

这篇关于使UL比它的父母LI更宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆