

v10_溢出属性_tianyi_666的技术博客_51CTO博客
source link: https://blog.51cto.com/u_14124898/5987026
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

v10_溢出属性_tianyi_666的技术博客_51CTO博客
空余空间属性 white-space
溢出隐藏中省略号显示
案例:写的页面如图所示,各个块在显示不全的状态下滚动显示,在鼠标划过时有选定显示

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" cnotallow="IE=edge">
<meta name="viewport" cnotallow="width=device-width, initial-scale=1.0">
<title>溢出</title>
<style>
*{
margin: 0;
padding: 0;
}
.box{
width: 890px;
height: 290px;
background: lavenderblush;
/* margin: left; */
overflow: auto; /*溢出部分滚动显示*/
}
.info{
width: 162px;
height: 112px;
border: 1px solid #808080;
float: left; /*浮动 实现横向排列*/
margin-right: 48px; /*设置小块外边距*/
margin-bottom: 20px;
}
.info:hover div{ /*伪类选择器,做鼠标悬停的效果*/
background: #219cea;
}
.info:hover .price{
color: white;
}
.info:hover .date{
color: white;
}
.info:hover .category{
color: #219cea;
background-image: url(./img/icon.png); /*悬停时 添加小图标 设置不平铺 位置调整 */
background-repeat: no-repeat;
background-position: right ;
}
.info div{
height: 84px;
background: #cccccc;
font-size: 12px;
}
.price{
height: 63px;
line-height: 63px; /*标签的行高*/
padding-left: 21px; /*设置标签内边距 实现字体在页面的位置*/
color: #b5b5b5;
}
.date{
padding-left: 21px;
color: #b5b5b5;
}
.category{
height: 28px;
background: white;
line-height: 28px; /*与整个高度齐平 实现垂直方向上居中*/
color: black;
text-align: center;
font-size: 12px;
}
</style>
</head>
<body>
<div class="box"> <!--外块>小块部分>块[有两个标签]+标签-->
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info"> <!--以下重复多个模块-->
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
<div class="info">
<div id="blk">
<p class="price">100.00</p>
<p class="date">有效期至20210521</p>
</div>
<p class="category">[店铺类][商城类]</p>
</div>
</div>
</body>
</html></div
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK