HTML - Tags - <nobr>

#90 of 147
nobr

 <html>
 <body>
     <div style="max-width: 16em">
         <p>
             1. The Hobbit was written by J. R. R. Tolkien in 1937.
         </p>
         <p>
             2. The Hobbit was written by
             <nobr>J. R. R. Tolkien<nobr> in 1937.
         </p>
         <p>
             3. The Hobbit was written by
             <span style="white-space: nowrap">J. R. R. Tolkien</span>
             in 1937.
         </p>
         <p>
             <nobr>
                 4. The Hobbit was written by J. R. R. Tolkien in 1937.
             </nobr>
         </p>
     </div>
 </body>
 </html>
 

The nobr element prevents the browser from inserting a line break.

Non-standard Use style="white-space: nowrap" instead.

In this example, we want to prevent the browser from inserting a line break in the author's name.

A live example:


1. The Hobbit was written by J. R. R. Tolkien in 1937.


2. The Hobbit was written by J. R. R. Tolkien in 1937.


3. The Hobbit was written by J. R. R. Tolkien in 1937.


4. The Hobbit was written by J. R. R. Tolkien in 1937.


N of

Ads by Google


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

© Richard McGrath