Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attribute 'nowrap' is considered outdated. A newer construct is recommended. What is it?

People also ask

What is Nowrap attribute?

Attribute for <TD ...> NOWRAP NOWRAP indicates that text should not wrap in the cell. NOWRAP serves much the same purpose as the <NOBR> tag. For example, the following cell will not wrap not matter how long the text. this code. produces this.

What is Nowrap in computer?

The HTML <td> nowrap Attribute is used to specify that the content present inside the cell should not wrap. It contains the Boolean value.


You can use it like this, I hope you wont get outdated message now.

  <td valign="top" style="white-space:nowrap" width="237">

As pointed by @ThiefMaster it is recommended to put width and valign to CSS (note: CSS calls it vertical-align).

1)

<td style="white-space:nowrap; width:237px; vertical-align:top;">

2) We can make a CSS class like this, it is more elegant way

In style section

.td-some-name
{
  white-space:nowrap;
  width:237px;
  vertical-align:top;
}

In HTML section

<td class="td-some-name">

There are several ways to try to prevent line breaks, and the phrase “a newer construct” might refer to more than one way—that’s actually the most reasonable interpretation. They probably mostly think of the CSS declaration white-space:nowrap and possibly the no-break space character. The different ways are not equivalent, far from that, both in theory and especially in practice, though in some given case, different ways might produce the same result.

There is probably nothing real to be gained by switching from the HTML attribute to the somewhat clumsier CSS way, and you would surely lose when style sheets are disabled. But even the nowrap attribute does no work in all situations. In general, what works most widely is the nobr markup, which has never made its way to any specifications but is alive and kicking: <td><nobr>...</nobr></td>.


If HTML and use bootstrap they have a helper class.

<span class="text-nowrap">1-866-566-7233</span>

Although there's CSS defines a text-wrap property, it's not supported by any major browser, but maybe vastly supported white-space property solves your problem.