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

后端 未结 4 1623
独厮守ぢ
独厮守ぢ 2020-12-29 02:03

I\'m getting an error when compiling this within an ASPX page using Visual Studio 2010:

    

4条回答
  •  独厮守ぢ
    2020-12-29 02:34

    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: ....

提交回复
热议问题