首页 / 知识

HTML<nobr>强制不换行标签元素

2023-04-11 14:43:00

nobr标签特点:
 
如不遇到br换行标签,内容在一行显示完,如遇到br换行标签,内容将在加br换行自动换行。
 
html nobr禁止内容换行案例
 
这里假如有4行文章标题列表,设置宽度为200px;css行高为22px;对4列的内容我们采用ul li列表布局,其中2个对内容加<nobr>标签,一个li内容不加,另外一个li内容少与宽度能显示完。
 
完整html源代码:
 
 
 
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 
<title>nobr标签实例</title> 
 
<style> 
 
ul{ border:1px solid #000; width:200px;} 
 
li{ width:200px; line-height:22px} 
 
</style> 
 
</head> 
 
<body> 
 
<ul> 
 
<li><nobr>第一排内容文字多加nobr标签测试内容</nobr></li> 
 
<li><nobr>第二排内容文字多加nobr标签不能排下</nobr></li> 
 
<li>第三排内容文字多没有加nobr标签</li> 
 
<li>第四排 文字少能排下</li> 
 
</ul> 
 
</body> 
 
</html>






本文转载自中文网



 

标签换行元素列表显示行高

最新内容

相关内容

热门文章

推荐文章

标签云

猜你喜欢