纯CSS实现小圆点和三角形图案

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>纯CSS制作三角形和小圆点</title>
<style>
.arrowbox{width:40px;height:30px;background: #000;padding:10px;position: relative;text-align:center;margin:20px;color:#fff;line-height:30px;font-size:12px;}
.arrowbox span{display: inline-block;overflow:hidden;vertical-align: middle;position:absolute;top:22px;right:5px;line-height:12px;font-size:12px;}
.arrowbox span em{display:block;font-family:"Simsun";font-style:normal;font-weight:normal;}
.arrowbox span.size1{width:7px;height:4px;}
.arrowbox span.w_e{width:4px;height:7px;}
.arrowbox span.size2{width:14px;height:8px;}
.arrowbox span em.north{color:#fff;margin:-7px 0 0 -2px;}
.arrowbox span em.south{color:#fff;margin:0 0 0 -2px;}
.arrowbox span.w_e em.east{color:blue;margin: -2px 0 0 -7px;}
.arrowbox span.w_e em.west{color:yellow;margin:-2px 0 0 0;}
.arrowbox span.size2 em.south{margin:-5px 0 0 0}
.arrowbox span.size2 em.north{margin:2px 0 0 0}
.round{width:16px;height:16px;display: inline-block;font-size:20px;line-heigth:16px;text-align:center;color:#f00;text-decoration:none}
.round:hover{color:blue;text-decoration:none} 
</style>
</head>
<body>
<div class="arrowbox">首页<span class="size1"><em class="north">◆</em></span></div>
<div class="arrowbox">首页<span class="size1"><em class="south">◆</em></span></div>
<div class="arrowbox">首页<span class="w_e"><em class="east">◆</em></span></div>
<div class="arrowbox">首页<span class="w_e"><em class="west">◆</em></span></div>
<div class="arrowbox">首页<span class="size2"><em class="south">◆</em></span></div>
<div class="arrowbox">首页<span class="size2"><em class="north">◆</em></span></div>
<p>用font-size控制圆点的大小</p>
<a href="#" class="round">●</a>
</body>
</html>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
CSS小圆点轮播图可以通过使用CSS动画和CSS伪类来实现。下面是实现的步骤: 1. HTML结构:首先,我们需要创建一个包含轮播图和小圆点的容器。容器内部包含一个图片轮播的div和一个小圆点的ul。结构如下: ```html <div class="slider-container"> <div class="slider"> <img src="image1.jpg" alt="Image 1"> <img src="image2.jpg" alt="Image 2"> <img src="image3.jpg" alt="Image 3"> </div> <ul class="dots"> <li class="active"></li> <li></li> <li></li> </ul> </div> ``` 2. CSS样式:然后我们需要对容器和其中的元素进行样式设置。设置容器的宽度和高度,使其适配轮播图的大小。设置轮播图的宽度、高度以及隐藏超出容器的部分。设置小圆点的样式,包括位置、颜色和大小等。CSS样式如下: ```css .slider-container { width: 300px; height: 200px; overflow: hidden; position: relative; } .slider { width: 300%; height: 100%; display: flex; transition: transform 0.5s ease-in-out; } .slider img { width: 33.33%; height: 100%; object-fit: cover; } .dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); list-style-type: none; margin: 0; padding: 0; } .dots li { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: grey; margin: 0 5px; } .dots li.active { background-color: black; } ``` 3. CSS动画和伪类:最后,我们需要使用CSS动画和伪类来实现轮播图的滑动效果和小圆点的切换效果。使用`@keyframes`定义滑动动画,使用`nth-child()`伪类来切换小圆点的激活状态。CSS代码如下: ```css @keyframes sliderAnimation { 0% { transform: translateX(0); } 33.33% { transform: translateX(-100%); } 66.66% { transform: translateX(-200%); } 100% { transform: translateX(-300%); } } .slider:hover { animation: sliderAnimation 3s infinite; } .dots li:hover, .dots li.active { background-color: black; } ``` 以上就是使用CSS实现小圆点轮播图的步骤和代码。你可以根据实际需要进行样式调整和功能扩展。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值