Label and description

Line breaking

Under normal conditions, a description will not break long-running text and the text may be cropped or hidden. To cause the text to wrap:

Ensure the long-running text is a text node child of <description/> or <label/> (i.e., do not specify the long-running text in the value attribute of these elements).

The default style for these XUL elements includes white-space: wrap;. This reduces all whitespace chunks (including newlines) to single spaces. Text is permitted to wrap.

<description>I am your father's brother's nephew's cousin's former roommate. What's that make us? Absolutely nothing!</description>

With white-space: pre; all whitespace, including newlines, is rendered literally. Text cannot wrap automatically but can still be achieved with <html:br/> if desired.

<description style="white-space: pre-wrap;">I am your father's brother's nephew's cousin's former roommate. What's that make us? Absolutely nothing!</description>

With white-space: pre-wrap; all whitespace is rendered literally, but text is additionally permitted to wrap at spaces.

Note: Prior to Firefox 3, it was necessary to use -moz-pre-wrap instead of -pre-wrap.  You may wish to use both for backward compatibility.
<description style="white-space: pre;">I am your father's brother's nephew's cousin's former roommate.
 What's that make us?
 Absolutely nothing!</description>

Text can also be made to wrap by inserting an <html:br/> element regardless of the CSS style, but this creates a hard-break that does not change as parent elements resize.

<description>I am your father's brother's nephew's cousin's former roommate.<html:br/>
What's that make us?<html:br/>
Absolutely nothing!</description>

Using labels as anchors

Its possible to make a label look and act like an HTML <a> tag:

<label class="text-link" href="http://whatever.com" value="click here to go to whatever"/>

"text-link" is a built-in, predefined class.

Note: if running in a XULRunner application add the following preferences to your default preferences file:
pref("network.protocol-handler.expose.http", false);
pref("network.protocol-handler.warn-external.http", false);

Change or add additional protocols (https or ftp) as needed.

Document Tags and Contributors

Contributors to this page: Sheppy, Kray2, ericjung, MarkFinkle, Chbok, wbamberg, Shadow101
Last updated by: wbamberg,