更新第40个小实例

This commit is contained in:
DESKTOP-BM6RJU5\wyanh 2021-11-12 17:29:05 +08:00
parent 6bcf5004ea
commit f29d0491ff
3 changed files with 84 additions and 1 deletions

View File

@ -43,4 +43,5 @@
36. HTML5+CSS3小实例之伸缩式动态搜索框
37. HTML5+CSS3小实例之JS+CSS实现日月交替效果
38. HTML5+CSS3小实例之3D分层按钮的悬停效果
39. HTML5+CSS3小实例之手机充电特效
39. HTML5+CSS3小实例之手机充电特效
40. HTML5+CSS3小实例之抽屉式相册

50
css/40.css Normal file
View File

@ -0,0 +1,50 @@
*{
/* 初始化 取消内外边距 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 弹性布局 水平垂直居中 */
display: flex;
justify-content: center;
align-items: center;
background-color: #000;
}
.box{
width: 1200px;
height: 550px;
/* 弹性布局 水平排列 */
display: flex;
flex-direction: row;
/* 设置元素的倒影效果below是倒影在元素下方15px是元素和倒影的距离后面的属性是设置倒影渐变 */
-webkit-box-reflect: below 15px -webkit-linear-gradient(transparent 50%,rgba(255,255,255,0.3));
}
.img-box{
width: 100px;
height: 550px;
overflow: hidden;
/* 加个动画过渡 */
transition: 0.3s;
}
.img-box img{
width: 100%;
height: 100%;
/* 由于这里我的图片都是竖图,而容器是横向的,所以对图片做了以下处理,这里大家根据自己的图片进行调节即可 */
/* 对图片进行剪切,保留原始比例 */
object-fit: cover;
/* object-position属性一般与object-fit一起使用用来设置元素的位置 */
object-position: 50% 20%;
}
/* 默认最后一张展开 */
.img-box:nth-child(5){
width: 800px;
}
/* 鼠标移入,图片展开 */
.img-box:hover{
width: 800px;
}
.img-box:hover ~ .img-box:nth-child(5){
width: 100px;
}

32
html/40.html Normal file
View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>抽屉式相册</title>
<link rel="stylesheet" href="../css/40.css">
</head>
<body>
<div class="box">
<div class="img-box">
<img src="../images/op/1.jpg" alt="">
</div>
<div class="img-box">
<img src="../images/op/2.jpg" alt="">
</div>
<div class="img-box">
<img src="../images/op/3.jpg" alt="">
</div>
<div class="img-box">
<img src="../images/op/4.jpg" alt="">
</div>
<div class="img-box">
<img src="../images/op/5.jpg" alt="">
</div>
</div>
</body>
</html>