使用CSS3实现百叶窗
2024-09-09 10:24:19
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>使用CSS3实现百叶窗</title>
<meta name="keywords" content="" />
<meta name="description" content="" /> <style>
*{margin:0;padding:0;}
body{}
ul,li{list-style:none;}
#banner{width:800px;height:500px;margin:60px auto;border:3px solid #082323;position:relative; }
#banner .pic li{width:200px;height:500px;float:left;position:relative;overflow:hidden;}
#banner .pic li div{width:200px;height:500px;position:absolute;left:-200px;} #banner .pic li div:nth-child(1){background-image:url("images/1.jpg");}
#banner .pic li div:nth-child(2){background-image:url("images/2.jpg");}
#banner .pic li div:nth-child(3){background-image:url("images/3.jpg");}
#banner .pic li div:nth-child(4){background-image:url("images/4.jpg");} #banner .pic li:nth-child(1) div{background-position:0;}
#banner .pic li:nth-child(2) div{background-position:-200px;}
#banner .pic li:nth-child(3) div{background-position:-400px;}
#banner .pic li:nth-child(4) div{background-position:-600px;} input{display:none;} /*隐藏radio按钮*/
label{display:block;width:20px;height:20px;background:#999;z-index:2;
border-radius:100%;color:#fff;position:absolute;bottom:15px;
text-align:center;line-height:20px;
}
label:nth-child(2) {right:100px;}
label:nth-child(4) {right:70px;}
label:nth-child(6) {right:40px;}
label:nth-child(8) {right:10px;}
input:checked + label{background:#0A7979;} /*+获取紧邻兄弟元素加上背景*/ /*~获取相邻兄弟改变div的位置*/
input#ra1:checked ~ .pic li div:nth-child(1){left:0;transition:0.6s;}
input#ra2:checked ~ .pic li div:nth-child(2){left:0;transition:0.6s;}
input#ra3:checked ~ .pic li div:nth-child(3){left:0;transition:0.6s;}
input#ra4:checked ~ .pic li div:nth-child(4){left:0;transition:0.6s;} </style>
</head>
<body> <div id="banner"> <input type="radio" id="ra1" name="choose" checked><label for="ra1">1</label>
<input type="radio" id="ra2" name="choose"><label for="ra2">2</label>
<input type="radio" id="ra3" name="choose"><label for="ra3">3</label>
<input type="radio" id="ra4" name="choose"><label for="ra4">4</label> <ul class="pic">
<li><div></div><div></div><div></div><div></div></li>
<li><div></div><div></div><div></div><div></div></li>
<li><div></div><div></div><div></div><div></div></li>
<li><div></div><div></div><div></div><div></div></li>
</ul>
</div> </body>
</html>
最新文章
- 解决scrollview和viewpager冲突
- golang os/exec 执行外部命令
- problem during schema create,statement create sequence act_evt_log_seq
- 转载:第五弹!全球首个微信小程序(应用号)开发教程!通宵吐血赶稿,每日更新!
- TranslateAnimation 使用详解
- winform 发邮件
- mysql、sqlServer、hsql、oracle、db2各数据库支持的字段类型与最大精度
- 三角形(hd1249)
- perl eval函数
- gunicorn geventworker 解析
- 移动端Html5控制布局
- LeetCode难度与出现频率
- [LeetCode_94] Binary Tree Inorder Traversal
- <;meta http-equiv=";X-UA-Compatible"; content=";ie=edge";>;的意思
- Git(四)Git的分支管理
- django 用户管理相关的表
- MongoDB 多实例安装成服务
- python 判断列表字符串元素首尾字符是否相同
- Docker虚拟机172.17网段冲突,导致网络访问问题
- mybaties association 只返回一个结果问题处理
热门文章
- auto_ptr浅析(转载)
- mybatis存入数据库后没有时分秒时间不全只有年月日
- 希尔排序( Shell Sort)
- C语言 给字符数组赋值的方法
- Fresco 源码分析(二) Fresco客户端与服务端交互(1) 解决遗留的Q1问题
- 在iOS开发中,给项目添加新的.framework
- KVM中Linux虚拟机的硬盘添加方法
- 解决Windows和Ubuntu时间不一致的问题
- pl/sql developer 登陆提示ORA-12514(转)
- CC2540开发板学习笔记(六)&mdash;&mdash;AD控制(自带温度计)