Home >Web Front-end >HTML Tutorial >How to disallow line breaks in enclosed text in HTML?

How to disallow line breaks in enclosed text in HTML?

PHPz
PHPzforward
2023-09-08 17:01:051607browse

How to disallow line breaks in enclosed text in HTML?

Use the tag to allow enclosed text in HTML to not break. The HTML tag instructs the browser not to corrupt specified text.

This is used in conjunction with the tag, which will advise the extension browser when it can insert a newline character in an unbreakable sequence. text. Unlike the
tag, which always causes a line break even within the segment of a - tag, the tag only occurs when placed within a content segment of a - tag Works and only causes a line break if the current line has exceeded the browser's bounds. Show window margins.

Example

You can try running the following code to allow enclosed text in HTML to not break -

<!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>

The above is the detailed content of How to disallow line breaks in enclosed text in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete