<!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>

最新文章

  1. 解决scrollview和viewpager冲突
  2. golang os/exec 执行外部命令
  3. problem during schema create,statement create sequence act_evt_log_seq
  4. 转载:第五弹!全球首个微信小程序(应用号)开发教程!通宵吐血赶稿,每日更新!
  5. TranslateAnimation 使用详解
  6. winform 发邮件
  7. mysql、sqlServer、hsql、oracle、db2各数据库支持的字段类型与最大精度
  8. 三角形(hd1249)
  9. perl eval函数
  10. gunicorn geventworker 解析
  11. 移动端Html5控制布局
  12. LeetCode难度与出现频率
  13. [LeetCode_94] Binary Tree Inorder Traversal
  14. &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot;&gt;的意思
  15. Git(四)Git的分支管理
  16. django 用户管理相关的表
  17. MongoDB 多实例安装成服务
  18. python 判断列表字符串元素首尾字符是否相同
  19. Docker虚拟机172.17网段冲突,导致网络访问问题
  20. mybaties association 只返回一个结果问题处理

热门文章

  1. auto_ptr浅析(转载)
  2. mybatis存入数据库后没有时分秒时间不全只有年月日
  3. 希尔排序( Shell Sort)
  4. C语言 给字符数组赋值的方法
  5. Fresco 源码分析(二) Fresco客户端与服务端交互(1) 解决遗留的Q1问题
  6. 在iOS开发中,给项目添加新的.framework
  7. KVM中Linux虚拟机的硬盘添加方法
  8. 解决Windows和Ubuntu时间不一致的问题
  9. pl/sql developer 登陆提示ORA-12514(转)
  10. CC2540开发板学习笔记(六)&mdash;&mdash;AD控制(自带温度计)