【发布时间】:2018-10-11 02:44:12
【问题描述】:
我想在一个按钮中隐藏一个 html 表单。我尝试在表单周围添加一个按钮,类似于带有子 div 的父 div,但这似乎不起作用。我对如何添加“隐藏”元素感到困惑。我必须使用 javascript 还是 jQuery?或者有没有一种简单的方法可以只使用 CSS 或 HTML?
提前致谢!!
/*LOGIN*/
html {
background: #fff;
font-size: 10pt;
}
.loginform ul {
padding: 0;
margin: 0;
}
.loginform il {
display: inline;
float: top right;
}
label {
display: block;
color: #ED4337;
}
label:hover {
background-color: #fff;
color: white;
border-radius: 8px;
}
.cf:before .cf:after {
content: "";
display: table;
}
.cf:after {
*zoom: 1;
}
:focus {
outline: 0;
}
.loginform input:not([type=submit]) {
padding: 5px;
margin-right: 10px;
border: 1px solid rgba(0, 0, 0, 0.3);
border-radius: 3px;
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 1px 0px 0px rgba(250, 250, 250, 0.5);
}
.loginform input[type=submit] {
border: 1px solid rgba(0, 0, 0, 0.3);
background: #64c8ef;
/*old browsers*/
background: -moz-linear-gradient(top, #64c8ef 0%, #00a2e2 100%);
/*FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(100%, #00a2e2));
background: -webkit-linear-gradient(top, #64c8ef 0%, #00a2e2 100%);
background: -o-linear-gradient(top, #64c8ef 0%, #00a2e2 100%);
background: -ms-linear-gradient(top, #64c8ef 0%, #00a2e2 100%);
background: linear-gradient(to bottom, #64c8ef 0%, #00a2e2);
filter: progid:DXImageTransform.Microsoft.gradient ( startColors)='#64c8ef', endColorstr='#00a2e2', GradientType=0);
color: #fff;
padding: 5px 15px;
margin-right: 0;
margin-top: 15px;
border-radius: 3px;
text-shadow: 1px 1px 0px #fff;
}
/*END LOG IN */
<!--LOG IN INFO-->
<button class="log">Log In
<section class="loginfrom cf">
<form name="login" action="index_submit" method="get" accept-charset="utf-8">
<ul>
<li><label for="username">Email</label>
<input type="email" name="usermail" placeholder="yourname@email.com"
required></li>
<li><label for="password">Password</label>
<input type="email" name="password" placeholder="password" required></li>
<li>
<input type="submit" value="Login"></li>
</ul>
</form>
</section>
</button>
<!--END LOG IN INFO-->
【问题讨论】:
-
我不明白你想从那个大按钮中得到什么?是否要在有人单击“取消隐藏”按钮之前隐藏表单?
-
@CharlesShiller:是的!确切地。在实际点击发生之前,我不确定如何隐藏表单。
-
@CharlesShiller:我的 CSS 中有一堆东西——我编辑了它,因为 sn-p 没有在第一次添加它。我将在哪里添加显示:隐藏; ? :P 非常感谢您的帮助;我是自学成才,所以我只是想充分利用所有资源:) PS:CSS 中的 .log 是登录按钮,但我也有一个单独的 .log:hover 。
-
@AndreiGheorghiu 抱歉,显示:无或可见性:隐藏。
-
@Cheyenne,当您说要在按钮中隐藏表单时,您是否意味着您希望在单击按钮时显示表单?在这种情况下,您正在寻找modals。
标签: html css forms button hide