![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to allow no breaks in the enclosed text in HTML?
To allow no breaks in the enclosed text in HTML, we will use <nobr> tag for creating a single line text, it does not bother about how long the statement is. If we want to read whole text a horizontal scroll has to be used. It is exactly opposite to <br> break tag. <nobr> tag is not supported in HTML5. This tag does not contain any attribute, it is having an open and closed tags.
The <nobr> tag in HTML
The HTML <nobr> tag is used to instruct the browser not to break the specified text. This is used with the <wbr> tag, <wbr> advises the extended browser when it may insert a line break in an otherwise nonbreakable sequence of text.
Unlike the <br> tag, which always causes a line break, even within a <nobr>- tagged segment, the <wbr> tag works only when placed inside a <nobr>- tagged content segment and causes a line break only if the current line has already extended beyond the browser's display window margins.
Syntax
Following is the syntax of <nobr> tag in HTML −
<nobr> Statement </nobr>
Example
Following example, demonstrates the usage of <nobr> tag in HTML −
<!Doctype html> <html> <head> <title>nobr Tag in HTML</title> <style> h1 { color: blue; } </style> </head> <body> <center> <h1>TutorialsPoint</h1> <h4>HTML nobr tag</h4> <nobr> Tutorials Point is a leading Ed Tech company striving to provide the best learning material on technical and non-technical subjects. </nobr> </center> </body> </html>
Example
Following is another example of the <nobr> tag in HTML −
<!DOCTYPE html> <html> <head> <title>HTML nobr Tag</title> </head> <body> <nobr>This is a very long sequence of text that is forced to be on a single line, even if doing so causes <wbr /> the browser to extend the document window beyond the size of the viewing pane and the poor user must scroll right <wbr /> to read the entire line. </nobr> </body> </html>
Example
In the following example we are trying to restrict breaks in the enclosed text −
<!DOCTYPE html> <html> <head> <title>nobr Tag Demonstration</title> <style> p.a { white-space: nowrap; } </style> </head> <body> <h1>Using CSS property white-space</h1> <p class="a"> It is a very long text which is very inconvenient to read, as it is written in one line, and you have to scroll horizontally to read it. </p> </body> </html>