HTML nowrap Attribute
The obsolete HTML nowrap attribute was historically used to prevent text and other content from automatically wrapping onto additional lines within certain elements, particularly table cells.
nowrap attribute is obsolete and should not be used in modern HTML. Use the CSS white-space property to control whether text can wrap.
Historical Syntax
The nowrap attribute was a Boolean attribute, so its presence enabled the no-wrapping behavior:
<td nowrap>This text was prevented from wrapping onto another line.</td>
When the available width was too small for the content, the cell could become wider rather than allowing the text to wrap normally.
Historical Elements
The nowrap attribute was historically associated with table cells and some other older HTML elements.
| Element | Historical Purpose |
|---|---|
<td> |
Prevented content in a table data cell from automatically wrapping onto multiple lines. |
<th> |
Prevented content in a table header cell from automatically wrapping onto multiple lines. |
Historical Use
Authors commonly used nowrap when they wanted table content such as dates, identification numbers, short labels, or other values to remain on a single line.
<table>
<tr>
<th>Product</th>
<th nowrap>Date Available</th>
</tr>
<tr>
<td>Garden Tools</td>
<td nowrap>September 25, 2026</td>
</tr>
</table>
Preventing wrapping could make short values easier to read, but it could also force a table to become wider than the available page or screen width.
Why It Became Obsolete
The nowrap attribute controls presentation rather than the structure or meaning of the document. CSS provides dedicated properties for controlling how whitespace and line wrapping are handled.
Moving this behavior to CSS also makes it easier to apply the same wrapping rules to multiple elements and to change those rules for different layouts or screen sizes.
Modern Alternative
Use the CSS white-space property with the nowrap value when text should remain on a single line.
Historical HTML
<td nowrap>September 25, 2026</td>
Modern HTML
<td class="no-wrap">September 25, 2026</td>
Modern CSS
.no-wrap {
white-space: nowrap;
}
The CSS white-space: nowrap declaration prevents normal line wrapping within the selected element. The text continues on one line unless an explicit line break is present.
white-space: nowrap only when keeping the content on one line is important to the layout.
Learn More About CSS Text
The CSS tutorials explain how whitespace and text wrapping can be controlled with CSS:
- CSS White Space - Learn how the
white-spaceproperty controls spaces and line wrapping. - CSS Styling Tables - Learn how CSS can control the presentation of HTML tables.
Legacy Browser Support
The nowrap attribute was widely recognized by older browsers, particularly when used with table cells.
Modern browsers may continue to recognize legacy uses for compatibility with older webpages, but new and updated webpages should use the CSS white-space property instead.
For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.
Related Attributes
Other obsolete presentational attributes historically associated with tables include:
align- Historically controlled horizontal alignment.valign- Historically controlled vertical alignment.bgcolor- Historically controlled background color.char- Historically identified a character used for table-cell alignment.charoff- Historically specified an offset for character-based table alignment.
Specifications
The nowrap attribute on table cells is obsolete and should not be used in modern HTML. Use the CSS white-space property when content needs to remain on one line. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.
