Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.
width
Type: string (representing an integer)
The preferred width of the element. The value should not include a unit as all values are in pixels. The actual displayed width may be different if the element or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. The CSS width property may also be used.

In this example, the preferred width of the inner hbox will be displayed at 40 pixels. The displayed width is also 40 pixels as no flexibility or alignment applies.

<hbox>
  <hbox width="40" style="background-color: red;">
    <label value="40"/>
  </hbox>
</hbox>

However, in the following example, despite that the preferred width of the box is 30 pixels, the displayed size of the box will be larger to accommodate the larger label.

<vbox width="30" align="start" style="background-color: red;">
  <label value="vbox xul width 10px red"/>
</vbox>
Note: When used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object.

Document Tags and Contributors

 Contributors to this page: Sheppy, Marsf, Mgjbot, Enn, Jez, Ramaboule, Okome, Dria
 Last updated by: Sheppy,