html中li class,列表里一项<li class="current">好</li>设置CSS样式为什么没…

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

CSS:

.newnote{clear: both;margin:0;padding-top:25px;}

.newnote ul{text-align:center;}

.newnote li.tesu{border:none;}

.newnote li{display:inline;float:left;text-align:center;padding:0 11px;border-right:1px solid #000;}

.newnote li a{color:#555;}

.newnote li a:hover{color:#ff0000;}

html:

#if($friendinfo>0)

($friendinfo)
好友

#else ($friendinfo)
好友
#end

#if($groupinfo>0)

($groupinfo)
群组

#else ($groupinfo)
群组
#end

#if($noteinfo>0)

($noteinfo)
通知

#else ($noteinfo)
通知
#end

#if($boxinfo>0)

($boxinfo)
短信

#else ($boxinfo)
短信
#end

#if($celinfo>0)

($celinfo)
提醒

#else ($celinfo)
提醒
#end
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
为了使图片可以轮播,需要在CSS和JavaScript文件添加相应的代码。下面是一个基本的轮播图实现示例: HTML部分: ```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>Document</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <div id="lunbo"> <ul id="img"> <li class="current"><a href="1.html"><img src="img/banner1.png" alt=""></a></li> <li><a href="2.html"><img src="img/banner2.jpg" alt=""></a></li> <li><a href="3.html"><img src="img/banner3.png" alt=""></a></li> </ul> <ul id="index"> <li class="current">1</li> <li>2</li> <li>3</li> </ul> </div> <script src="js/script.js"></script> </body> </html> ``` CSS部分: ```css #lunbo { width: 600px; height: 400px; margin: 0 auto; position: relative; } #img { width: 600px; height: 400px; list-style: none; position: relative; overflow: hidden; } #img li { width: 600px; height: 400px; position: absolute; top: 0; left: 0; } #img li img { display: block; width: 100%; height: 100%; } #index { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); } #index li { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background-color: #fff; margin-right: 10px; text-align: center; line-height: 20px; color: #333; cursor: pointer; transition: background-color .5s ease-in-out; } #index li.current { background-color: #333; color: #fff; } ``` JavaScript部分: ```javascript var index = 0; var timer = null; var imgArr = document.querySelectorAll('#img li'); var indexArr = document.querySelectorAll('#index li'); var len = imgArr.length; function init() { imgArr[0].style.opacity = 1; indexArr[0].classList.add('current'); for (var i = 0; i < len; i++) { indexArr[i].setAttribute('data-index', i); indexArr[i].addEventListener('mouseover', function() { clearInterval(timer); index = parseInt(this.getAttribute('data-index')); changeImg(); }); indexArr[i].addEventListener('mouseout', function() { play(); }); } play(); } function play() { timer = setInterval(function() { index++; index = index % len; changeImg(); }, 2000); } function changeImg() { for (var i = 0; i < len; i++) { imgArr[i].style.opacity = 0; indexArr[i].classList.remove('current'); } imgArr[index].style.opacity = 1; indexArr[index].classList.add('current'); } init(); ``` 其,init()函数用于初始化轮播图,play()函数用于播放轮播图,changeImg()函数用于切换图片。在init()函数,需要为小圆点添加鼠标移入和移出事件,以便停止和重新播放轮播图。在play()函数,使用setInterval()方法定时切换图片,changeImg()函数用于切换图片并更新小圆点的状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值