CSS - What is the CSS equivalent of the HTML tag <nobr>

The CSS equivalent of the HTML tag nobr is

white-space: nowrap;
.nowrap {
    white-space: no-wrap;
}

In the example below (a simulated narrow width device), the web browser inserts a line-break at the hyphen character, which we don't want. We can prevent the insertion of a line break by using the HTML tag nobr (no-break), or by using the CSS rule white-space: nowrap;

Before:

There is a fifth state of matter called the Bose-
Einstein condensate.

After:

There is a fifth state of matter called the
Bose-Einstein condensate.

HTML (original):

There is a fifth state of matter called the Bose-Einstein condensate.

HTML using nobr:

There is a fifth state of matter called the <nobr>Bose-Einstein</nobr> condensate.

HTML using white-space:nowrap:

There is a fifth state of matter called the <span class="nowrap">Bose-Einstein</span> condensate.

or

There is a fifth state of matter called the <span style="white-space: nowrap">Bose-Einstein</span> condensate.


Ads by Google


Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath