基于文字的下拉菜单更大 [英] Wider dropdown based on text

查看:115
本文介绍了基于文字的下拉菜单更大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下脚本:

http://jsfiddle.net/oshirowanen/6SUwR/3/

如何根据下拉菜单中的字符为下拉菜单部分设置动态宽度?例如,如果导航1"是这是导航中的第一项",那么我如何自动使整个下拉菜单的宽度变宽,但又不影响导航按钮的大小,而当鼠标悬停在导航按钮上时会导致下拉菜单是吗?

How do I give the drop down section a dynamic width based on the characters in the dropdown? For example, if "navigation 1" was "this is the first item in the navigation", How do I make the width of the whole dropdown wider automatically, but without affecting the size of the navigation button which causes the dropdown the dropdown when mouseover'ed?

基本上,我不想在下拉列表中输入文字,但与此同时,我也不想为下拉菜单扩大按钮.

Basically, I don't want to text to wrap in the dropdown, but at the same time, I don't want to button for the dropdown to go wider.

推荐答案

这是您要的吗?

http://jsfiddle.net/lukemartin/W9TzP/

基本上,只需将.container的宽度设置为auto,然后从.container上取下背景色,然后将其放在每个单独的.nav_item上.还添加了一些浮点和清除,以便设置正确的宽度.

Basically just set the .container's width to auto, and then took the background-color off of the .container and put it on each individual .nav_item. Also added some floats and clears so correct widths are set.

希望有帮助:)

这篇关于基于文字的下拉菜单更大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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