Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces menubar menuitem Width

Tags:

primefaces

I am having trouble with the 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>
like image 672
user784298 Avatar asked Mar 27 '12 02:03

user784298


2 Answers

if you want the width follow your content, use this

ul.ui-menu-child {
    white-space: nowrap;
    width: auto !important;
}
like image 190
Aaron Avatar answered Nov 05 '22 05:11

Aaron


use this:

<style>    
       ul.ui-menu-child
        {
            white-space: nowrap;
            width: 290px !important;
        }
</style>

Only change the pixels that you need :) and dropdown width of menu will change.

like image 6
DANYDHSV Avatar answered Nov 05 '22 06:11

DANYDHSV