文本單行溢出顯示省略號
實(shí)現(xiàn)文本單行溢出顯示,需要給該文本的盒子加一定寬度
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
具體demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>lvyweb</title>
<style>
p{
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
width: 200px;
}
</style>
</head>
<body>
<p>實(shí)現(xiàn)文本單行溢出顯示,需要給該文本的盒子加一定寬度實(shí)現(xiàn)文本單行溢出顯示,需要給該文本的盒子加一定寬度</p>
</body>
</html>
文本單行溢出顯示省略號,鼠標(biāo)懸停會顯示全部,hover的時(shí)候設(shè)置寬度auto
具體demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>lvyweb</title>
<style>
p{
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
width: 200px;
}
p:hover { width:auto; }
</style>
</head>
<body>
<p>實(shí)現(xiàn)文本單行溢出顯示,需要給該文本的盒子加一定寬度實(shí)現(xiàn)文本單行溢出顯示,需要給該文本的盒子加一定寬度</p>
</body>
</html>