CSS to achieve dynamic secondary menu

CSS to achieve dynamic secondary menu

Dynamically implement a simple secondary menu

When the mouse is placed on the first-level label, the mouse will change into a small hand shape to display the second-level menu. The source code is as follows. You can copy it and use it directly.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {margin: 0; padding: 0;}
        ul { list-style: none;}
        div {
            width: 100%;
            height: 50px;
            background-color: #ccc;
        }
        .first {
            width: 100px;
            height: 50px;
            float: left;
            margin-right: 70px;
            /* background-color: pink; */
            cursor: pointer;
            text-align: center;
            line-height: 50px;
            border-radius: 15px;
        }
        .second li{
            width: 80px;
            height: 50px;
            background-color: blue;
            border-radius: 50%;
            margin-top: 10px;
        }
        .second {
            display: none;
        }
        .first:hover .second{
            display: block;
            cursor: pointer;
        }
        .first:hover {
            background-color: pink;
        }
    </style>

<body>
    <div>
        <ul>
            <li class="first">
                <p>First level tag</p>
                <ul class="second">
                    <li>Second level tags</li>
                    <li>Second level tags</li>
                </ul>
            </li>

            <li class="first">
                <p>First level tag</p>
                <ul class="second">
                    <li>Second level tags</li>
                    <li>Second level tags</li>
                </ul>
            </li>
        </ul>
    </div>

</body>
</html>

Summarize

This is the end of this article about how to implement dynamic secondary menu with CSS. For more relevant CSS dynamic secondary menu content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  Disabled values ​​that cannot be entered cannot be passed to the action layer

>>:  A practical record of encountering XSS attack in a VUE project

Recommend

CSS3 simple cutting carousel picture implementation code

Implementation ideas First, create a parent conta...

Linux bridge method steps to bridge two VirtualBox virtual networks

This article originated from my complaints about ...

MySQL 5.7.18 version free installation configuration tutorial

MySQL is divided into installation version and fr...

CSS Transition expands and collapses elements by changing the Height

A common development need is that we want to coll...

Add a startup method to Linux (service/script)

Configuration file that needs to be loaded when t...

Several solutions for forgetting the MySQL password

Solution 1 Completely uninstall and delete all da...

Share 8 CSS tools to improve web design

When one needs to edit or modify the website desi...

Detailed explanation of MySQL injection without knowing the column name

Preface I feel like my mind is empty lately, as I...

Analysis of Vue element background authentication process

Preface: Recently, I encountered a management sys...

Native JS to achieve directory scrolling effects

Here is a text scrolling effect implemented with ...

Detailed explanation of how to view MySQL memory usage

Preface This article mainly introduces the releva...

Customization Method of Linux Peripheral File System

Preface Generally speaking, when we talk about Li...

SQL Optimization Tutorial: IN and RANGE Queries

Preface "High Performance MySQL" mentio...

How to configure the My.ini file when installing MySQL5.6.17 database

I recently used the MySql database when developin...

Solution to MySQL master-slave delay problem

Today we will look at why master-slave delay occu...