Reputation: 43
So I'm making a simple login form and I want position these two label texts on top their respective inputs instead of having this big space gap. Fairly new sorry.
HTML
<form>
<fieldset>
<label>Username
<input type="username" class="button-user">
</label>
<label>Password
<input type="password" class="button-pw">
</label>
</fieldset>
<fieldset class="button-space">
<input type="submit" class="button">
</fieldset>
</form>
CSS
fieldset {
width: 200px;
}
.button-space {
height: 50px;
background: #f0f0f2;
border-top: 1px;
}
.button {
margin-top: 13px;
}
.button-pw {
margin-top: 20px;
}
.button-user {
margin-top: 20px;
}
Upvotes: 1
Views: 3221
Reputation: 1264
That should solve it ;)
fieldset {
width: 200px;
}
.button-space {
height: 50px;
background: #f0f0f2;
border-top: 1px;
}
.button {
margin-top: 13px;
}
.button-pw {
display:block;
margin-bottom:20px;
}
.button-user {
display:block;
margin-bottom:20px;
}
And if you don't want that gap space between the PW-textbox and then button, then set margin-bottom
to 0px in .button-pw
http://jsfiddle.net/ypNUU/6/
Upvotes: 0
Reputation: 58531
Make the following changes...
/*.button-pw {
margin-top: 20px;
}*/
.button-user {
/*margin-top: 20px;*/
margin-bottom: 20px;
}
And it will look like...
Demo: http://jsfiddle.net/ypNUU/4/
Upvotes: 0
Reputation: 21
Hi you can change the margin-to like this
.button-pw {
margin-top: 0px;
}
.button-user {
margin-top: 0px;
}
Upvotes: 0
Reputation: 281485
Remove these rules:
.button-pw {
margin-top: 20px;
}
.button-user {
margin-top: 20px;
}
They are adding the gap between the labels and the fields. Fiddle here.
Upvotes: 2