HTML <nobr> Tag

The <nobr> tag is creates a text with non-breaking lines. It doesn't allow the text to divide multiple lines automatically. With the <nobr> tag the text is displayed in a single line, and a horizontal scroll bar appears to make it readable.

Usually, if the text goes outside of the screen, the browser automatically break the text to the next line, but the <nobr> tag does not allow to break the line.

The <nobr> is a non-standard element. Although it may still work in some browsers, its use is discouraged since it can be removed at any time. Use the CSS white-space property instead.


The <nobr> tag comes in pairs. The content is written between the opening (<nobr>) and closing (</nobr>) tags.

Example of the HTML <nobr> tag:

<!DOCTYPE html>
    <title>Title of the document</title>
     Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.


You can use the CSS white-space property instead of the <nobr> element and achieve the same result.

Example of the CSS white-space property instead of the <nobr> tag:

<!DOCTYPE html>
    <title>Title of the document</title>
      p.a {
        white-space: nowrap;
    <h1>Example of using the CSS property white-space</h1>
    <p class="a">
      It is an ordinary and very long text that is very inconvenient to read, as it is written in one line, and you have to scroll horizontally to read it.


The <nobr> tag supports the Global Attributes and the Event Attributes.

How to style <nobr> tag?

Common properties to alter the visual weight/emphasis/size of text in <nobr> tag:

  • CSS font-style property sets the style of the font. normal | italic | oblique | initial | inherit.
  • CSS font-family property specifies a prioritized list of one or more font family names and/or generic family names for the selected element.
  • CSS font-size property sets the size of the font.
  • CSS font-weight property defines whether the font should be bold or thick.
  • CSS text-transform property controls text case and capitalization.
  • CSS text-decoration property specifies the decoration added to text, and is a shorthand property for text-decoration-line, text-decoration-color, text-decoration-style.

Coloring text in <nobr> tag:

  • CSS color property describes the color of the text content and text decorations.
  • CSS background-color property sets the background color of an element.

Text layout styles for <nobr> tag:

  • CSS text-indent property specifies the indentation of the first line in a text block.
  • CSS text-overflow property specifies how overflowed content that is not displayed should be signalled to the user.
  • CSS white-space property specifies how white-space inside an element is handled.
  • CSS word-break property specifies where the lines should be broken.

Other properties worth looking at for <nobr> tag:

Browser support

Do you find this helpful?

Related articles