Primefaces menubar menuitem 宽度 [英] Primefaces menubar menuitem Width

查看:37
本文介绍了Primefaces menubar menuitem 宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

菜单项有问题:(

想要包含图片,但不允许所以没有它的问题是愚蠢的

Wanted to include a pic, but wasnt allowed So question is stupid without it

我似乎无法更改下拉菜单的宽度,我在我的脑海中包含了一个样式,并在其中包含了一个宽度属性每个菜单项,但它们没有任何区别:

I can't seem to change the width of the drop down menu, I have included a style in my head and a width attrib in each menuitem, but they have made no difference:

<style>
ui-menu .ui-menu-parent .ui-menu-child
{
    width: 400px; /* exagerated !! */
}
</style>

当菜单项高亮时,选择栏的宽度是正确的!

When the menu item is higlighted, the selection bar is the correct width !

任何线索???,这是一个示例菜单栏

Any Clues ???, here is an example menubar

<p:menubar>
    <p:submenu label="Menu 1"
        style="text-align: left;">

        <p:menuitem ajax="false" 
                    action="/Page1"
                    value="Page 1" 
                    style="width: 350px;"/>

        <p:menuitem ajax="false" 
                    action="/too_long_page"
                    value="Some really long menu text that is far too long"
                    style="width: 350px;" />

        <p:menuitem ajax="false" 
                    action="/too_long_page"
                    value="Some really long menu text that is far too long"
                    style="width: 350px;" />

    </p:submenu>
    <p:menuitem ajax="false" 
                action="/Page2"
                value="Page 2" />
</p:menubar>

推荐答案

如果你想让宽度跟随你的内容,使用这个

if you want the width follow your content, use this

ul.ui-menu-child {
    white-space: nowrap;
    width: auto !important;
}

这篇关于Primefaces menubar menuitem 宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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