1 Star 0 Fork 19

蝶飞依心/blog网页特效源码

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
纯CSS轮播图.html 3.47 KB
一键复制 编辑 原始数据 按行查看 历史
北极光之夜 提交于 2021-09-27 22:19 . 'before-code'
<!--
* @Author: your name
* @Date: 2021-05-16 17:40:34
* @LastEditTime: 2021-05-16 21:34:33
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \undefinedd:\练习\纯CSS轮播图.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>北极光之夜。</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: rgb(164, 202, 224);
}
.main{
position: relative;
width: 400px;
height: 250px;
overflow: hidden;
border-radius: 5px;
}
.item{
position: absolute;
top: 0;
width: 100%;
height: 100%;
transition: all 0.5s;
background-size: cover;
}
.item1{
background-image: url(./img/1.jpg);
}
.item2{
background-image: url(./img/4.jpg);
left: 100%;
}
.item3{
background-image: url(./img/11.jpg);
left: 200%;
}
input{
position: relative;
z-index: 100;
/* display: none; */
}
.select{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
width: 60px;
height: 10px;
z-index: 1;
display: flex;
justify-content: space-between;
align-items: center;
}
.select>label{
width: 10px;
height: 10px;
background-color: rgb(255, 255, 255);
border-radius: 50%;
cursor: pointer;
border: 1.5px solid white;
}
.main input:nth-of-type(1):checked ~ .select label:nth-of-type(1){
background-color: rgb(26, 26, 26);
}
.main input:nth-of-type(2):checked ~ .select label:nth-of-type(2){
background-color: rgb(26, 26, 26);
}
.main input:nth-of-type(3):checked ~ .select label:nth-of-type(3){
background-color: rgb(26, 26, 26);
}
.main input:nth-of-type(1):checked ~ .item{
transform: translateX(0);
}
.main input:nth-of-type(2):checked ~ .item{
transform: translateX(-100%);
}
.main input:nth-of-type(3):checked ~ .item{
transform: translateX(-200%);
}
</style>
</head>
<body>
<!-- 底层盒子 -->
<div class="main">
<!-- 三个单选按钮,先默认选择第一个 -->
<input type="radio" name="choose" id="choose1" checked>
<input type="radio" name="choose" id="choose2">
<input type="radio" name="choose" id="choose3">
<!-- 放三张图片,用背景图片表示 -->
<div class="item item1"></div>
<div class="item item2"></div>
<div class="item item3"></div>
<!-- 三个label标签 -->
<span class="select">
<label for="choose1"></label>
<label for="choose2"></label>
<label for="choose3"></label>
</span>
</div>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/diefei-yixin/blog.git
git@gitee.com:diefei-yixin/blog.git
diefei-yixin
blog
blog网页特效源码
master

搜索帮助