• 自定义selsct


    //自定义select,使用到了伪类,利用border制作小三角形

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=yes" />
    <title>select</title>
    <style type="text/css">
    *{margin: 0; padding: 0;}
    .box{ 222px; margin: 50px auto;}
    p{ 200px; border: 1px solid #ccc; height: 50px; line-height: 50px; padding: 0 10px; position: relative;}
    p:after{ 0; height: 0; content: ''; display: block; position: absolute; right: 6px; top: 50%; margin-top: -2px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid #505050;}
    ul{ 222px; display: none; height: 120px; overflow: hidden; overflow-y: scroll;}
    li{ 200px; padding: 0 10px; border: 1px solid #CCCCCC; height: 50px; line-height: 50px; list-style: none;}
    </style>
    </head>
    <body>
    <div class="box">
    <p>上海</p>
    <ul>
    <li>北京</li>
    <li>天津</li>
    <li>广州</li>
    <li>安庆</li>
    <li>合肥</li>
    </ul>
    </div>
    <script src="jquery-1.11.1.min.js"></script>
    <script>
    $(function(){
    $('p').click(function(){
    $('ul').show();
    })
    $('li').click(function(){
    $('p').html($(this).html());
    $('ul').hide();
    })
    })
    </script>
    </body>
    </html>

  • 相关阅读:
    Java 多线程分析 (六) ----三种方式实现Thread
    图论--深度优先遍历DFS
    图---邻接链表建立
    打印从1到n位数(防止数据溢出)
    Java 基础知识理解
    l链表的反转
    RecordList
    ArrayList
    git仓库相关知识02-远程仓库
    git仓库相关知识01-安装和基本命令
  • 原文地址:https://www.cnblogs.com/zhuyuanyuan/p/5146854.html
Copyright © 2020-2023  润新知