VISHAL DAGA
VISHAL DAGA

Reputation: 4289

Fix width for dojo MenuItem

If the menuitem text is a big string, the menuitem becomes too wide and don't look much good.

For example

<div dojoType="dijit/Menu">        
  <div data-dojo-type="dijit/MenuItem">
      A Big String as Menu item. The menuitem looks ugly as it becomes too wide.
  </div>  
</div>

Is it possible to set a fixed width to the menuitem and the text wraps automatically ?

Upvotes: 1

Views: 190

Answers (1)

iH8
iH8

Reputation: 28628

You could set a max-width and normal whitespace wrap on .dijitMenuItemLabel Setting them on .dijitMenuItem won't work.

.dijitMenuItemLabel {
    max-width: 100px;
    white-space: normal;
}

Since you said that long buttons are really ugly, i'm wondering how you feel about a menu that has buttons with different heights. I'm thinking that won't work as wel, but that's for you to decide.

Upvotes: 1

Related Questions