我为我的导航栏编写了一个下拉登录表单,它正常但不完全正常,当我将鼠标悬停在表单出现的区域时,它似乎也会下降:
鼠标只是悬停在显示下拉列表的某个区域,但它没有这样做,当我只悬停在" ingresar"时它应该下降,如何解决这个问题?此外,我不希望我的鼠标看起来像我可以点击表格,它应该看起来很正常。
.login-box {
width: 350px;
height: 420px;
padding: 80px 40px;
box-sizing: border-box;
background: rgba(0, 0, 0, .8);
position: absolute;
right: 0px;
top: 100%;
opacity: 0;
}
.menu li:hover .login-box {
opacity: 1;
}
h2 {
margin: 0;
padding: 0 0 10px;
color: #efed40;
text-align: center;
}
.login-box p {
margin: 0;
padding: 0;
font-weight: bold;
color: white;
}
.login-box input {
width: 100%;
margin-bottom: 20px;
}
.login-box input[type="text"],
.login-box input[type="password"] {
border: none;
border-bottom: 1px solid #fff;
background: transparent;
outline: none;
height: 40px;
color: #fff;
font-size: 16px;
}
::placeholder {
color: rgba(255, 255, 255, .3);
font-family: sans-serif;
font-weight: bold;
}
.login-box input[type="submit"] {
border: none;
outline: none;
height: 40px;
color: #fff;
font-size: 16px;
background: #ff267e;
cursor: pointer;
border-radius: 20px;
}
.login-box input[type="submit"]:hover {
background: #efed40;
color: #262626;
}
.login-box a {
color: #fff;
font-size: 14px;
font-weight: bold;
text-decoration: none;
}

<ul class="menu">
<li>INICIO</li>
<li class="with-arrow">CONTACTO</li>
<li class="with-arrow">REGISTRATE</li>
<li class="with-arrow">INGRESAR
<div class="login-box">
<h2>Ingresa tus datos</h2>
<form>
<p>CORREO</p>
<input type="text" name="" placeholder="Escribir e-mail">
<p>CONTRASEÑA</p>
<input type="password" name="" placeholder="Escribir Contraseña">
<input type="submit" name="" value="Listo">
<a href="">¿Contraseña olvidada?</a>
</form>
</div>
</li>
</ul>
&#13;
答案 0 :(得分:1)
您需要将下拉列表设置为不可见,因此不能在其中应用悬停事件
.login-box{
width: 350px;
height: 420px;
padding: 80px 40px;
box-sizing: border-box;
background: rgba(0, 0, 0, .8);
position: absolute;
right: 0px;
top: 100%;
opacity: 0;
/* === NEW ==== */
visibility: hidden;
}
.menu li:hover .login-box{
opacity: 1;
/* === NEW ==== */
visibility: visible;
}
<强> visibility 强>