【发布时间】:2020-04-29 09:24:57
【问题描述】:
我有一个表单包裹在一个div中,每个表单元素和输入元素都有一个类.form-container
<div class="form-popup" id="myForm">
<form method = "post" action="<?php echo $_SERVER['PHP_SELF'];?>" class="form-container">
<h1 style="color: white;">Login</h1>
<label for="name" style="color: white;"><b>Username</b></label>
<input type="text" placeholder="Enter username" name="name" required>
<label for="email" style="color: white;"><b>Email</b></label>
<input type="email" placeholder="Enter email" name="email" required>
<label for="psw" style="color: white;"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="password" required !important>
<button type="submit" class="btn">Login</button>
<button type="submit" class="btn cancel" onclick="closeLogInForm()">Close</button>
</form>
</div>
表单容器类:
/* Full-width input fields */
.form-container input[type=text], .form-container input[type=password], .form-container input [type=email]{
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
}
由于某种原因,只有持有 type="email" 的输入元素不会像其他输入元素一样呈现,尽管应用了相同的 .form-container 类:
使用 text 或 password 类型向表单输入任意数量的输入元素都可以正常工作。 那么是什么导致了这种意外的渲染呢?
【问题讨论】: