Reputation: 93
I made a template for a login page and I think so far it looks pretty good! But I'm stuck on two things. I want to move the whole login "box" down about 25px and the "Login" button dow about 10-20px. How can I do this?
CSS and HTML code:
body {
background-color: #224b65;
}
#boxTitle {
background-color: #ffd11a;
margin: auto;
text-align: center;
padding-top: 10px;
width: 300px;
height: 200px;
border-top: 0px solid #ffd11a;
border-radius: 5px 5px 0px 0px;
}
#infoBoxes {
background-color: white;
padding: 10px;
border-radius: 0px 0px 5px 5px;
}
<!DOCTYPE html>
<html>
<head>
<title>Please Login</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="content">
<div id="boxTitle">
<h1 class="loginTitle">Please Login</h1>
</div>
<div id="infoBoxes">
<form>
<h3 class="usernameText">Username</h3><input type="text" class="usernameBox" />
<h3 class="passwordText">Password</h3><input type="password" class="passwordBox" />
<input class="button" type="submit" value="Login" />
</form>
</div>
</div>
</body>
</html>
Upvotes: 1
Views: 8671
Reputation: 2968
I Think isn't this what you need, cause it's too easy, just adding margin-top
body {
background-color: #224b65;
}
#content{
margin-top: 25px;
}
#boxTitle {
background-color: #ffd11a;
margin: auto;
text-align: center;
padding-top: 10px;
width: 300px;
height: 200px;
border-top: 0px solid #ffd11a;
border-radius: 5px 5px 0px 0px;
}
#infoBoxes {
background-color: white;
padding: 10px;
border-radius: 0px 0px 5px 5px;
}
.button {
display: block;
margin-top: 20px;
}
<!DOCTYPE html>
<html>
<head>
<title>Please Login</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="content">
<div id="boxTitle">
<h1 class="loginTitle">Please Login</h1>
</div>
<div id="infoBoxes">
<form>
<h3 class="usernameText">Username</h3><input type="text" class="usernameBox" />
<h3 class="passwordText">Password</h3><input type="password" class="passwordBox" />
<input class="button" type="submit" value="Login" />
</form>
</div>
</div>
</body>
</html>
Upvotes: 0
Reputation: 1793
Use the margin-top
property to add space above an element:
#boxTitle {
margin-top: 25px;
}
.button {
margin-top: 15px;
}
Upvotes: 2