如何在HTML中包含的文本不间断?
使用<nobr>标记不允许在HTML中包含的文本中出现任何中断。HTML<nobr>标记用于指示浏览器不要破坏指定的文本。
它与<wbr>标记一起使用,<wbr>在扩展浏览器可能以其他方式不可中断的文本序列插入换行符时建议使用。与<br>标记始终会导致换行,即使在<nobr>-标记的段中也不同,<wbr>标记仅在置于<nobr>-标记的内容段中时才起作用,并且仅当当前行已超出浏览器的显示窗口边距。
示例
您可以尝试运行以下代码,以使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>