首页 > 开发 > CSS > 正文

DIV点击折叠实例代码

2024-07-11 08:39:52
字体:
来源:转载
供稿:网友

废话不多说了,关键代码如下所示:

CSS Code复制内容到剪贴板

<!doctype html>    
<html>    
<head>    
    <meta charset="utf-8">    
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">   
    <title>测试</title>    
    <style type="text/css">   
        *{ margin:0; padding:0;}   
        .menu{ width:100%;}   
        .menu .item{ width:100%; height:auto; background-color: #fefefe;}   
        .menu .item h1{ font-size:15px; width:100%; position:relative;}   
        .menu .item h1 i{ display: inline-block; height:15px; width:10px; position:absolute; rightright:10px; top:0; background: url(images/rightright.png) no-repeat; background-size:10px auto;}   
        .menu .item ul{ display: none;}   
        .menu .item ul li{ list-style:none; color:#000; background-color: #fefefe; border-bottom:solid 1px #ededed; line-height: 32px; width:100%; position:relative;}   
        .menu .item ul li p{ display: none;}           
        .menu .item.active h1 i{ display: inline-block; height:10px; width:15px; position:absolute; rightright:10px; top:3px; background: url(images/down.png) no-repeat; background-size:15px auto;}   
        .menu .item ul li span.icon{display: inline-block; height:15px; width:10px; position:absolute; rightright:10px; top:0; background: url(images/rightright.png) no-repeat; background-size:10px auto;}   
        .menu .item ul li.active span.icon{ display: inline-block; height:10px; width:15px; position:absolute; rightright:10px; top:3px; background: url(images/down.png) no-repeat; background-size:15px auto;}   

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表