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

Implementation of mounting NFS shared directory in Docker container

Previously, https://www.jb51.net/article/205922.h...

How to start a Vue.js project

Table of contents 1. Node.js and Vue 2. Run the f...

wget downloads the entire website (whole subdirectory) or a specific directory

Use wget command to download the entire subdirect...

Detailed explanation of the use of shared memory in nginx

In the nginx process model, tasks such as traffic...

Introduction to MySQL MHA operation status monitoring

Table of contents 1. Project Description 1.1 Back...

Solution to the cross-domain problem of SpringBoot and Vue interaction

Table of contents Browser Same Origin Policy 1. V...

How to configure Linux firewall and open ports 80 and 3306

Port 80 is also configured. First enter the firew...

A brief discussion on HTML ordered lists, unordered lists and definition lists

Ordered List XML/HTML CodeCopy content to clipboa...

Detailed explanation of the use of Vue h function

Table of contents 1. Understanding 2. Use 1. h() ...

IE6 distortion problem

question: <input type="hidden" name=...

MySQL5.7 single instance self-starting service configuration process

1.MySQL version [root@clq system]# mysql -v Welco...

Let's learn about JavaScript object-oriented

Table of contents JavaScript prototype chain Obje...

A brief introduction to Tomcat's overall structure

Tomcat is widely known as a web container. It has...

MySQL 5.7 installation and configuration method graphic tutorial

This tutorial shares the installation and configu...