css强制一行展示
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.row {
width:200px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
background-color:#CCC;
}
</style>
</head>
<body>
<div class="row"> 衣带渐宽终不悔,为伊消得人憔悴 </div>
</body>
</html>
-white-space 属性设置如何处理元素内的空白
-nowrap:文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止
-text-overflow 属性规定当文本溢出包含元素时发生的事情
-clip:修剪文本
-ellipsis:显示省略符号来代表呗修剪的文本
本文标题:css强制一行展示
本文链接:https://www.haomeiwen.com/subject/efpgzktx.html
网友评论