gpt4 book ai didi

html - 过渡不适用于不透明度

转载 作者:太空宇宙 更新时间:2023-11-03 23:36:06 27 4
gpt4 key购买 nike

所以我有一个带有两个按钮的标题,登录和加入,当用户将鼠标悬停在其中一个按钮上时,我会放下一个带有一些输入和一个按钮的容器。我希望下拉菜单使用 css opacity 淡入淡出,但我无法让它工作也许还有其他更好的方法。谢谢,这是一个fiddle .

HTML:

<div id="membership_container">
<div id="login_button">
<span id="login_text">Login</span>
<div class="form_containers" id="login_box">
<div class="form_inner_containers">
<form action="/login" method="POST">
<input class="inputs" placeholder="Email" type="text" name="login_email"/>
<input class="inputs" placeholder="Password" type="password" name="login_password"/>
<input class="buttons" type="submit" value="Login"/>
</form>
</div>
</div>
</div><!--
--><div id="join_button">
<span id="join_text">Join</span>
<div class="form_containers" id="join_box">
<div class="form_inner_containers">
<form action="/join" method="POST">
<input class="inputs" placeholder="Your Name" type="text" name="name"/>
<input class="inputs" placeholder="Email" type="text" name="email"/>
<input class="inputs" placeholder="Password" type="password" name="password"/>
<input class="buttons" type="submit" value="Join"/>
</form>
</div>
</div>
</div>
</div>

CSS:

#membership_container {
float: right;
position: relative;
vertical-align: top;
display: inline-block;
height: 100%;
margin: 0px;
padding: 0px;
background-color: #444444;
text-align: center;
}
#login_button {
position: relative;
vertical-align: top;
display: inline-block;
float: left;
height: 100%;
margin: 0px;
padding: 0px 10px;
background-color: #444444;
border-left: 2px solid #7B7B7B;
border-right: 2px solid #7B7B7B;
cursor: pointer;
cursor: hand;
}
#login_button:hover {
background-color: #696969;
}
#login_button #login_box {
display: none;
opacity: 0.0;
}
#login_button:hover #login_box {
display: block;
opacity: 1;
}
#login_text {
position: relative;
margin: 9px 0px 0px;
text-align: center;
color: white;
display: inline-block;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
#join_button {
position: relative;
vertical-align: top;
display: inline-block;
float: left;
height: 100%;
margin: 0px;
background-color: #444444;
padding: 0px 10px;
border-right: 2px solid #7B7B7B;
cursor: pointer;
cursor: hand;
}
#join_button:hover {
background-color: #696969;
}
#join_button:hover #join_box {
display: block;
opacity: 1.0;
}
#join_text {
position: relative;
margin: 9px 0px 0px;
text-align: center;
color: white;
display: inline-block;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}

.button_blur {
background-color: #444444;
}
.button_blur:hover {
background-color: #696969;
}
.button_focus {
background-color: #696969;
}
.form_containers {
z-index: 10;
position: absolute;
display: none;
opacity: 0.0;
border: 5px solid #888888;
border-radius: 10px 0px 10px 10px;
background-color: #F1F1F1;
-o-transition: opacity .8s linear;
-ms-transition: opacity .8s linear;
-moz-transition: opacity .8s linear;
-webkit-transition: opacity .8s linear;
transition: opacity .8s linear;
}
#login_box {
top: 35px;
right: -2px;
/*left: -115px;*/
}
#join_box {
top: 35px;
right: -2px;
/*left: -73px;*/
}
.form_inner_containers {
position: relative;
margin: auto auto;
display: block;
background-color: #F1F1F1;
border-radius: 10px;
border: 0px;
}
.form_hidden {
display: none;
}
.form_shown {
display: block;
}
.inputs {
border-radius: 8px;
background-color: white !important;
outline: none;
border: 0px;
font-size: 22px;
padding: 10px;
margin: 10px;
box-shadow: 0px 0px 0px grey;
}
.inputs:focus {
box-shadow: 3px 3px 3px grey;
}
.buttons {
position: relative:
display: block;
background-color: #00ADEF;
margin: 10px;
border-radius: 8px;
padding: 10px 15px 8px;
width: 269px;
outline: none;
font-size: 22px;
border: 0px;
cursor: pointer;
cursor: hand;
color: #F1F1F1;
}
.buttons:hover {
background-color: #18B4EF;
}
.buttons:active {
background-color: #91D6F0;
color: #F1F1F1;
outline: none;
}

最佳答案

包含设置为“display: none;”隐藏它们。在悬停时,它们被设置为“显示: block ”,这会立即显示它们并忽略不透明度过渡。就个人而言,我发现这个“错误”非常烦人(它不是错误......但是,它很烦人)。

两个解决方法是 Javascript(困惑)和使用 CSS 关键帧动画。 http://hschwarz77.wordpress.com/2013/10/16/css-transition-from-display-none-to-display-block-on-hover/

据我所知,这些是使 div 完全隐藏(并且不可用...visibility:hidden 占据空间)并淡入的唯一解决方案。

关于html - 过渡不适用于不透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24085161/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com