纯CSS图片层叠点击展开

发布时间:2022-06-25 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了纯CSS图片层叠点击展开脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

源码:抖音[代码女神]

图片:https://www.3dmgame.com/games/yuanshen/qrwtj_535/

纯CSS图片层叠点击展开

纯CSS图片层叠点击展开

纯CSS图片层叠点击展开

纯CSS图片层叠点击展开

纯CSS图片层叠点击展开

<html>
<title>原神</title>
<head>
<style>
ul {
    width: 1000px;
    height: 500px;
    margin: 100px auto;
}

li {
    float: left;
    height: 500px;
    max-width: 710px;
    /* border:1px solid gray; */
    list-style: none;
}

ul :nth-child(1),
ul :nth-child(1) .bg {
    background: url(https://img.3dmgame.com/uploads/images/news/20200119/1579416175_275268.jpg) center/cover;
}

ul :nth-child(2),
ul :nth-child(2) .bg {
    background: url(https://img.3dmgame.com/uploads/images/news/20200119/1579417496_739273.jpg) center/cover;
}

ul :nth-child(3),
ul :nth-child(3) .bg {
    background: url(https://img.3dmgame.com/uploads/images/news/20200119/1579416877_919906.jpg) center/cover;
}

ul :nth-child(4),
ul :nth-child(4) .bg {
    background: url(https://img.3dmgame.com/uploads/images/news/20200119/1579418169_434972.jpg) center/cover;
}

ul :nth-child(5),
ul :nth-child(5) .bg {
    background: url(https://img.3dmgame.com/uploads/images/news/20200915/1600137306_223576.jpg) center/cover;
}

input {
    opacity: 0;
    width: 50px;
    height: 500px;    
    float: left;
    overflow: hidden;
    cursor: pointer;
    transition: 0.5s;
}

input:checked {
    width: 700px;
}

.bg {
    opacity: 0;
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    filter:blur(5px);
}

input:checked ~ .bg {
    opacity: 1;
}
</style>
</head>
<body>
<ul>
    <li>
        <input type="radio" name="switch" checked="checked">
        <div class="bg"></div>
    </li>
    <li>
        <input type="radio" name="switch">
        <div class="bg"></div>
    </li>
    <li>
        <input type="radio" name="switch">
        <div class="bg"></div>
    </li>
    <li>
        <input type="radio" name="switch">
        <div class="bg"></div>
    </li>
    <li>
        <input type="radio" name="switch">
        <div class="bg"></div>
    </li>
</ul>
</body>
</html>

脚本宝典总结

以上是脚本宝典为你收集整理的纯CSS图片层叠点击展开全部内容,希望文章能够帮你解决纯CSS图片层叠点击展开所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: