开发者

CSS Sub Navigation Auto Width

This has been bugging me quite a while. Please look at my fiddle here.

http://jsfiddle.net/y9uEf/

You can see that the Subnav can't seem to "grow" bigger if there's a very long text in it. I know that it's because its width will always be 100% of the parent (in this case the top menu Home, Who, Contact). I can add width in the subnav ul so that the subnav ul will be bigger, but that will work on all subnavs regardign the wid开发者_运维问答th of the subnav content.

Now what if I want it to be dynamic? For instance, if the subnav content only has "Short Text" (let's say it's about 50 pixels), then the subnav width will be 50 pixels. Then if the subnav content has a list with "A Very Very Very Long Text" (let's say it's about 200 pixels) then the subnav width will automatically be 200px.

Thanks


You can try to add a white-space: nowrap to your li.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜