【html5】纯css实现圆圈中显示居中文字效果

为了实现qq邮箱app的邮件显示效果,就是哪个邮件左边的图案,当没有找到对应logo时,以主题头一个字作为logo

代码如下:

<html>
<head>
<title>圆圈</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
.circle {
	width: 25px;
	height: 25px;
	border-style: solid;
	border-width: 1px;
	border-radius: 50%;
	-moz-border-radius: 50%; -webkit-border-radius : 50%;
	border-color: #1E90FF;
	-webkit-border-radius: 50%;
}

.circle-text {
	font-family:"黑体",Helvetica,"Arial","Microsoft YaHei","宋体",sans-serif;;
	width: 25px;
	height: 25px;
	line-height: 25px;
	text-align: center;
	font-size: 15px;
	font-weight:normal;
	color: #1E90FF;
}
</style>
</head>
<body>
	<div class="circle">
		<div class='circle-text'>京</div>
	</div>
	<br>
	<div class="circle">
		<div class='circle-text'>Pa</div>
	</div>
</body>
</html>

效果

 

新的效果-改良版

<html>
<head>
<title>圆圈</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">

.jy-circle{
    border: 1.5px solid #1E90FF;
    color: #1E90FF;
    font-size: 16px;
    border-radius: 100%;
    position: relative;
    z-index: 2;
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 28px;
    background-color: #FFF;
    text-align: center;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box; 
    font-family:font: 12px/1.5 Tahoma,Helvetica,Arial,'宋体',sans-serif;   
    }
</style>

</head>
<body>
	<span class="jy-circle">京</span>
	
	<span class="jy-circle">Pa</span>
</body>
</html>

 

 

 

 

轮播图圆圈的样式可以通过CSS进行设置,具体的实现步骤如下: 1. 首先,在HTML代码添加一个指示器容器,用于存放小圆圈指示器,例如: ```html <div class="indicator-container"></div> ``` 2. 在CSS代码设置指示器容器的样式,例如: ```css .indicator-container { position: absolute; /* 设置容器的定位方式为绝对定位 */ bottom: 10px; /* 设置容器距离轮播图底部的距离 */ left: 50%; /* 设置容器距离轮播图左侧的距离 */ transform: translateX(-50%); /* 将容器水平居中 */ display: flex; /* 设置容器为Flex布局 */ } ``` 3. 在CSS代码设置小圆圈指示器的样式,例如: ```css .indicator { width: 10px; /* 设置小圆圈的宽度 */ height: 10px; /* 设置小圆圈的高度 */ border-radius: 50%; /* 将小圆圈设置为圆形 */ margin-right: 10px; /* 设置小圆圈之间的间距 */ background-color: #ccc; /* 设置小圆圈的背景颜色 */ cursor: pointer; /* 将小圆圈设置为鼠标指针 */ } .indicator.active { background-color: #f00; /* 设置当前小圆圈的背景颜色 */ } ``` 4. 在JavaScript代码,根据轮播图的数量动态生成小圆圈指示器,并且在轮播图滚动时更新当前小圆圈的状态,例如: ```javascript var slider = document.querySelector('.slider'); var indicatorContainer = document.querySelector('.indicator-container'); for (var i = 0; i < slider.children.length; i++) { var indicator = document.createElement('div'); indicator.classList.add('indicator'); indicatorContainer.appendChild(indicator); } var indicators = document.querySelectorAll('.indicator'); function updateIndicator() { for (var i = 0; i < indicators.length; i++) { indicators[i].classList.remove('active'); } indicators[currentIndex].classList.add('active'); } updateIndicator(); ``` 以上是一个简单的轮播图小圆圈指示器的CSS样式设置和JavaScript代码实现,具体实现还需要根据实际需求进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值