What about a Bug, generated by css hover?

The

code is very simple. When you hover parent the mouse, it shows the hidden child in the parent. The problem is that when you click child many times at will, the mouse loses and the hover,child disappears. May I ask how to solve the problem?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .parent{
            width: 500px;
            height: 300px;
            background: -sharpccc;
            position: relative;
        }
        .parent:hover .child{
            display: block;
        }
        .child{
            width: 50px;
            height: 30px;
            background: red;
            position: absolute;
            top: 50px;
            left: 30px;
            cursor: pointer;
            display: none;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child"></div>
    </div>
</body>
</html>

the mouse has been clicked in the red area, and the mouse loses hover (Google Chrome)

.
Mar.23,2021

< div class= "child" > < / div > the tag here is not closed, but I haven't reproduced the problem you mentioned in multiple browsers.


clipboard.png
subject, I tested it under firefox,chrome and ie11, and it didn't disappear after clicking on the red area. How did you recreate it?


I don't know the specific reason, but you can add a style to solve

.parent:hover .child,
.child:hover{
    display: block;
}

No problem was found. What browser did the landlord use?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d29b-2c365.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d29b-2c365.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?