* { margin: 0; p " />
此前写的那个太复杂了,来点简单的核心
<html><head> <title></title> <style type="text/css"> * { margin: 0; padding: 0; border: none; } .bl { width: 600px; height: 540px; margin: 0 au天津高校排名to; position: relative; top: 50%; transform: translatey(-50%); } .bl > input { width: 20%; height: 40px; position: absolute; cursor: pointer; opacity: 0; } .bl input:nth-of-type(1){ left: 0%; } .bl input:nth-of-type(2){ left: 20%; } .bl input:nth-of-type(3){ left: 40%; } .bl input:nth-of-type(4){ left: 60%; } .bl input:nth-of-type(5){ left: 80%; } /*切换效果*/ .bl input:nth-of-type(1):checked ~ sbeganpan:nth-of-type(1) { color: white; } /* ~ 选择兄弟元素 */ .bl input:nth-of-type(2):checked ~ span:nth-of-type(2) { color: white; } .bl input:nth-of-type(3):checked ~ span:nth-of-type(3) { color: white; } .bl input:nth-of-type(4):checked ~ span:nth-of-type(4) { color: white; } .bl input:nth-of-type(5):checked ~ span:nth-of-type(5) { color: white; } .bl input:nth-of-type(1):checked ~ .pagebox > .pages { } .bl input:nth-of-type(2):checked ~ .pagebox > .pages { transform: translatey(-100%); } .bl input:nth-of-type(3):checked ~ .pagebox > .pages { transform: translatey(-200%); } .bl input:nth-of-type(4):checked ~ .pagebox > .pages { transform: translatey(-300%); } .bl input:nth-of-type(5):checked ~ .pagebox > .pages { transform: translatey(-400%); } span { display: block; width: 20%; height: 40px; background-color: red; float: left; text-align: center; 为了一个承诺作文 line-height: 40px; font-size: 20px; } .pagebox,.pages { width: 100%; height: 500px; } .pagebox { overflow: hidden; } .pages { transition: all 0.5s; } .page { width: 100%; height: 100%; text-align: center; font-family: "微软雅黑"; font-size: 30px; line-height: 500px; color: white; } .page1 { background-color: pink; } .page2 { background-color: blue; } .page3 { background-color: red; } .page4 { background-color: green; } .page5 { background-color: black; } </style></head><body> <div class="bl"> <input type="radio" name="btn" checked ><span>1</span> <input type="radio" name="btn" ><span>2</span> <input type="radio" name="btn" ><span>3</span> <input type="radio" name="btn" ><span>4</span> <input type="radio" name="btn" ><span>5</span> <ction class="pagebox"> 依旧造句短一点 <div class="pages"> <div class="page page1">this is page1</div> <div class="page page2">this is page2</div> <div class="page page3">this is page3</div> <div class="page page4">this is page4</div> <div class="page page5">this is page5</div> </div> </ction> </div></body></h地形和地貌的区别tml>
总结
以上所述是www.887551.com给大家介绍的纯css3制作页面切换效果的实例代码,希望对大家有所帮助
本文发布于:2023-04-07 03:59:49,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/c1af9d7be0aa363f221412446d34fd9c.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:纯CSS3制作页面切换效果的实例代码.doc
本文 PDF 下载地址:纯CSS3制作页面切换效果的实例代码.pdf
留言与评论(共有 0 条评论) |