这个问题出现的原因是当你用鼠标悬停在该容器上时,容器会消失。这通常是由于CSS选择器引起的。您可以通过添加CSS到代码中来解决此问题。以下是一个示例:
HTML:
Content goes here
CSS:
.parent {
position: relative;
width: 200px;
height: 200px;
background-color: lightgray;
margin: 10px;
}
.child {
position: absolute;
top: 100%;
left: 0;
width: 200px;
height: 200px;
background-color: white;
border: 1px solid black;
z-index: 999;
transition: all ease-in-out 0.3s;
}
.child.hide {
display: none;
}
在这个例子中,鼠标进入时子容器会显示,鼠标离开时子容器会消失。使用css的类选择器.hide来控制子容器的显示和隐藏。