天天看點

下拉框jQuery+css 下拉清單

jQuery+css 下拉清單

下拉框jQuery+css 下拉清單

主要代碼

<!DOCTYPE html>
<html>
<head >
    <meta charset="UTF-8">
    <title></title>
    <script src="js/jquery.js"></script>



    <style>
        .dropdown {
            position: relative;
            display: inline-block;
            height: 30px;
            width: 70px;
        background-color: pink;
             text-align: center;
            font-size: 15px;




        }
        .dropdown:hover {
            position: relative;
            display: inline-block;
            height: 30px;
            width: 70px;
            background-color: mediumpurple;
            text-align: center;
            font-size: 15px;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            height: 30px;
            width: 70px;
            background-color: mediumpurple;
            text-align: center;
            z-index: 1;
            font-size: 15px;

        }

        .dropdown:hover .dropdown-content {
            display: block;
            height: 120px;
            width: 70px;
            background-color: mediumpurple;
            text-align: center;
            font-size: 15px;
            top: 30px;
        }
        .dropdown1 {
            position: relative;
            display: inline-block;
            height: 30px;
            width: 70px;
            background-color: pink;
            text-align: center;
            font-size: 15px;
        }
        .dropdown1:hover {
            position: relative;
            display: inline-block;
            height: 30px;
            width: 70px;
            background-color: mediumpurple;
            text-align: center;
            font-size: 15px;
        }

        .dropdown-content1 {
            display: none;
            position: absolute;
            height: 30px;
            width: 70px;
            background-color: pink;
            text-align: center;
            z-index: 1;
            font-size: 15px;
        }

        .dropdown1:hover .dropdown-content1 {
            display: block;
            height: 120px;
            width: 70px;
            background-color: mediumpurple;
            text-align: center;
            font-size: 15px;
            top: 30px;
        }




        .dropdown2 {
            position: relative;
            display: inline-block;
            height: 30px;
            width: 70px;
            background-color: pink;
            text-align: center;
            font-size: 15px;
        }
        .dropdown2:hover {
            position: relative;
            display: inline-block;
            height: 30px;
            width: 70px;
            background-color: mediumpurple;
            text-align: center;
            font-size: 15px;
        }
        .dropdown-content2 {
            display: none;
            position: absolute;
            height: 30px;
            width: 70px;
            background-color: red;
            text-align: center;
            z-index: 1;
            font-size: 15px;
        }
        .dropdown2:hover .dropdown-content2 {
            display: block;
            height: 120px;
            width: 70px;
            background-color: pink;
            text-align: center;
            font-size: 15px;
            top: 30px;
        }
    </style>
</head>
<body>

<div class="dropdown">

    <table>
        <tr><td><span>班級</span></td></tr>

    </table>
    <div class="dropdown-content">
        <p>軟體1805</p>
        <p>軟體1806</p>
        <p>軟體1807</p>
    </div>
</div>


<div class="dropdown1">

    <table>
        <tr><td><span>專業</span></td></tr>

    </table>
    <div class="dropdown-content1">
        <p>軟體技術</p>
        <p>軟體技術</p>
        <p>軟體技術</p>
    </div>
</div>
</body>
</html>