You are here: Reference > JavaScript > client-side > HTML DOM > properties > noWrap (body, dd, div, dt, td, th)

noWrap property (body, dd, div, dt, td, th)

Browser support:
Specifies or returns whether the text in a table cell can be wrapped.
This property is deprecated. Use the whiteSpace or the wordWrap properties instead.

Syntax:

object.noWrap;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: NOWRAP

Possible values:

Boolean that indicates whether the text should be wrapped.
One of the following values:
false
Default. Browser wraps the text.
true
Browser does not wrap the text.
Default: false.

Example HTML code 1:

This example illustrates the use of the noWrap attribute:
<div style="width:150px;">
    <table border="1px" cellpadding="3px">
        <tr>
            <td nowrap="nowrap">The contents of this cell cannot be wrapped. The contents of this cell cannot be wrapped.</td>
        </tr>
    </table>
</div>
<div style="width:150px;">
    <table border="1px" cellpadding="3px">
        <tr>
            <td>The contents of this cell can be wrapped. The contents of this cell can be wrapped.</td>
        </tr>
    </table>
</div>
Did you find this example helpful? yes no

Example HTML code 2:

Recommendation:
<div style="width:150px;">
    <table border="1px" cellpadding="3px">
        <tr>
            <td style="white-space:nowrap;">The contents of this cell cannot be wrapped. The contents of this cell cannot be wrapped.</td>
        </tr>
    </table>
</div>
<div style="width:150px;">
    <table border="1px" cellpadding="3px">
        <tr>
            <td>The contents of this cell can be wrapped. The contents of this cell can be wrapped.</td>
        </tr>
    </table>
</div>
Did you find this example helpful? yes no

Example HTML code 3:

This example illustrates the use of the noWrap property:
<head>
    <script type="text/javascript">
        function ToggleWrap () {
            var tableData = document.getElementById ("myTData");
            tableData.noWrap = !tableData.noWrap;
        }
    </script>
</head>
<body>
    <div style="width:150px">
        <table border="1px" cellpadding="3px">
            <tr>
                <td id="myTData" nowrap="nowrap">The contents of this ........ cell cannot be wrapped.</td>
            </tr>
        </table>
    </div>

    <button onclick="ToggleWrap ();">Change wrap state!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content