Warum gehen die E-Mail- und Passwortbreiten außerhalb der Breite input-container
?Breite des CSS-Eingabeelements außerhalb des Containers
form {
background: #ccc;
}
.input-container {
background: red;
width: 469px;
margin: 0 auto;
}
.usermail,
.userpword {
margin-top: 10px;
}
input,
button {
width: 100%;
border-radius: 6px;
border: 1px solid #cacece;
padding: 10px 12px;
font-size: 1em;
}
.username input {
width: 206px;
}
<form action='' method='post' id='signupform'>
<div class='input-container'>
<div class='username'>
<input type='text' name='fname' id='fname' placeholder='First Name'>
<input type='text' name='lname' id='lname' placeholder='Last Name'>
</div>
<div class='usermail'>
<input type='email' name='email' id='email' placeholder='Email'>
</div>
<div class='userpword'>
<input type='password' name='pword' id='pword' placeholder='Password'>
</div>
<button>Sign Up</button>
</div>
</form>
Weil Ihre Polsterung, zählt nicht so in Richtung der Breite Deine Eingabe ist '100% + padding' breit. Verwenden Sie 'box-sizing: border-box', um dieses Problem zu lösen. Das Gleiche gilt auch für Ihre Grenze. – somethinghere
Mögliches Duplikat von [CSS-Eingabe mit Breite: 100% geht außerhalb der Elterngrenze] (http://stackoverflow.com/questions/16907518/css-input-with-width-100-goes-outside-parents-bound) – showdev
^Google "CSS Box Model" –