#CSS Challenge - Create a Nice Looking SignUp Form
Challenge 1 - Create the HTML Document
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>Challenge 2 - Link to your stylesheet
<link rel="stylesheet" href="css/main.css" media="screen" title="no title" charset="utf-8">When building any type of document with HTML/CSS. You always want craft the structure first and style afterwards.
We'll start by building out the body of our document and creating the form.
Challenge 3 - Set the Body up
- Inside the
<body>create a container<div>with theidattribute of login-box - Within the login-box
<div>, create another<div>with aclassof left - Inside of the 'left'
<div>, create a top-level header that contains the text: 'Create Account'
<body>
<div id="login-box">
<div class="left">
<h1>Create Account</h1>
</div>
</div>
</body>Challenge 4 - Create a sign-up Form
- Create a
<form>element which contains: 2. Aclassattribute titled 'sign-up' 3. Anactionattribute pointing to 'index.html'
The action attibute defines the location (an URL) where the form's collected data should be sent. 4. Amethodattribute with the value of 'post'
The method attribute defines which HTTP method to send the data with (it can be "get" or "post"). - Nest 4
<input>elements within the<form>2. A username input 3. An Email input 4. two password inputs (one for the actual password, and one to confirm) - Nest a
button(inside the<form>) with the following attributes: 4. Aclassattribute of 'sign-up-button' 5. Atypeattribute of 'submit' - Close out your 'left'
<div>
hint: You may want to check out the Mozilla or W3 documentation on how to create a form
Once complete, your index.html page should look something like this: 
Challenge 4 Answer:
<div class="left">
<h1>Create Account</h1>
<form class="sign-up" action="index.html" method="post">
<input type="text" name="username" placeholder="Username" />
<input type="text" name="email" placeholder="E-mail" />
<input type="password" name="password" placeholder="Password" />
<input type="password" name="password2" placeholder="Retype password" />
<button class="sign-up-button" type="submit"/> Sign Me Up </button>
</form>
</div>Challenge 5 - Buttons
- Create a
<div>with aclassattribute of 'right' - Nest a
<span>with theclassattribute of 'loginwith' inside of the 'right'<div>- Inside the
<span>put the text: 'Sign in with Social Network'
- Inside the
- Create 3
<button>'s with:classattributes of "social-signin"
- Select the top
<button>and- Assign a
classattribute of 'facebook' - Include the text: 'Log in with facebook'
- Assign a
- Do the same thing for Twitter and Google+
- close out the 'right'
<div>
**Challenge 5 Answer:**
<div class="right">
<span class="loginwith">Sign in with <br> social network</span>
<button class="social-signin facebook">Log in with facebook</button>
<button class="social-signin twitter">Log in with Twitter</button>
<button class="social-signin google">Log in with Google+</button>
</div>Create a <div> with the class attribute of "or" and the inner-text 'OR'
<div class="or">OR</div>Whew! You've complete the structure of the html document. Now all that's left is to add some style
Here's what your code should look like so far:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/main.css" media="screen" title="no title" charset="utf-8">
<title>Sign Up!</title>
</head>
<body>
<div id="login-box">
<div class="left">
<h1>Create Account</h1>
<form class="sign-up" action="index.html" method="post">
<input type="text" name="username" placeholder="Username" />
<input type="text" name="email" placeholder="E-mail" />
<input type="password" name="password" placeholder="Password" />
<input type="password" name="password2" placeholder="Retype password" />
<button class="sign-up-button" type="submit" />Sign Me Up</button>
</form>
</div>
<div class="right">
<span class="loginwith">Sign in with
<br />social network</span>
<button class="social-signin facebook">Log in with facebook</button>
<button class="social-signin twitter">Log in with Twitter</button>
<button class="social-signin google">Log in with Google+</button>
</div>
<div class="or">OR</div>
</div>
</body>
</html>That should produce something like this:

Okay, so first things first. We need to get rid of this awful default browser styling
Challenge 6 - Let's Normalize!
- Go to the site above and download the file 2. Create a new stylesheet and paste in the contents of normalize.css 3. link the stylesheet to your index.html page
**Before and After:** 
Challenge 6 Answer:
<link rel="stylesheet" href="css/normalize.css" media="screen" title="no title" charset="utf-8">(In the <head> make sure to link this above your main.css file. Otherwise it will overwrite all of your custom styles)
Start by using the * selector to apply border-box to the all of the elements.
* {
box-sizing: border-box;
}So, what does the above code do?
Well, according to learnlayout.com:
When you set box-sizing: border-box; on an element, the padding and border of that element no longer increase its width.
This is incredibly helpful as it removes unexpected layout issues.
Next we'll work on the body.
Challenge 7 - colors!
- Give the
bodya background color of#DDD - Give the text a color of
#222
**Challenge 7 Answer:**
body {
background: #DDD;
color: #222;
}While we're at it, let's go ahead and select a font (I've already picked out Noto Sans, but feel free to experiment)
Right below your * selector apply the following:
@import url(https://fonts.googleapis.com/css?family=Noto+Sans|Comfortaa:400,300,700);Now add the following to your body statement:
font-family: 'Noto Sans', sans-serif;
font-weight: 300;Which should result in the following code:
body {
background: #DDD;
color: #222;
font-family: 'Noto Sans', sans-serif;
font-weight: 300;
}Here's how it will look on the web:

That should take care of the body. Next positioning!
Challenge 8 (part 1) - The Login-Box
- Start by giving the
login-boxarelativeposition - Apply a
marginof 3.5%on the top/bottom 4.autoon the left/right - Give the box a
background-colorof#FFF
The Result you're looking for:

Challenge 8 (part 1) Answer:
#login-box {
position: relative;
margin: 5% auto;
}Great! Even though, it doesn't look like much happened. The good news is that our Login Box is responding.
Challenge 8 (part 2) - Now all we need to do is set a width and height and give it some style
- Set a
widthof600px - Set a
heightof400px - Refresh your browser and make sure the box is still responding
- Assign a
border-radiusof2px - Add some
box-shadowand assign the following values 6. horizontal shadow of:07. vertical shadow of:2px8. blur of:4px9. color of:rgba(0,0,0,0.4)
(hint: you may find this helpful for box-shadow)
Challenge 8 (part 2) Answer:
#login-box {
position: relative;
margin: 5% auto;
width: 600px;
height: 400px;
background: #FFF;
border-radius: 2px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}Ahhh much better. Now we can start focusing on the right and left <div>'s
Challenge 9 - Position the left <div>
-
Give the
<div>somepadding,heightandwidth2. padding of:40px3. width of:300px4. height of:400px -
Refresh your browser
You'll probably get something like this:
-
Now, give the left div an absolute position 7. Place it at at the top/left of it's parent
<div>
(You'll notice all sorts of weirdness happening with the right div. Just ignore it for the moment)
Challenge 9 Answer:
.left {
padding: 40px;
width: 300px;
height: 400px;
position: absolute;
top: 0;
left: 0;
}Challenge 10 - Position the right <div>
- Apply the same
attributes(from the .left<div>) to right<div>with one exception- Position this
<div>at the top right of it's parent<div>(instead of the top left)
- Position this
Thankfully, we can reuse a good bit of the code from our left <div>. yay!
hint: see if you can refactor a little bit.
Challenge 10 Answer:
.left,
.right {
padding: 40px;
width: 300px;
height: 400px;
position: absolute;
top: 0
}
.left {
left: 0;
}
.right {
right: 0;Let's go ahead and throw in our background picture while we're here.
In your .right declaration (under the right: 0; declaration) paste the following code:
.right {
right: 0;
background: url('https://goo.gl/YbktSj');
background-size: cover;
background-position: center;
border-radius: 0 2px 2px 0;
}Refresh and take a deep breath. We're getting close!
Let's go ahead and knock out the styling on our left <div>
We'll start with the <h1>
Type the following code in your stylesheet:
h1 {
margin: 0 0 20px 0;
font-weight: 300;
font-size: 2em;
}Refresh if you want to see the change
Challenge 11 - The sign-up form inputs
-
Let's start by removing that border
-
Now apply a border to only the bottom. 3. give it a
1pxsolid bottom-border 4. give it the color#AAA -
Give each input a
displayofblock -
Now, apply some margin and padding to make it look pretty 7. Separate the inputs by adding a bottom margin of
20px8. add about4pxofpadding -
Refresh
-
Add some height and width... 11.
heightof32px12.widthof220px -
Make the font a little stronger by giving it a weight of 400
**The Result:** 
Challenge 11 Answer:
.sign-up input {
border: none;
border-bottom: 1px solid #AAA;
display: block;
margin-bottom: 20px;
padding: 4px;
width: 220px;
height: 32px;
font-weight: 400;
}Cool, things are starting to look decent. Let's go ahead and work on the button next.
Challenge 12 - The Sign Me Up Button
- Let's properly apply spacing and width/height
2. give a top and bottom margin of
5px3. awidthof220px4. aheightof32px - While we're at it, go ahead and remove the border
- give it a
border-radiusof2px - Apply some color!
8. give the background a color of
#16A0859. set the text color to#FFF - Finally, set the
transform-textproptery touppercase, and thefont-weightto400
The Result:
Here's what you should have so far.
Challenge 12 Answer:
.sign-up-button {
margin: 5px auto;
width: 220px;
height: 32px;
border: none;
border-radius: 2px;
background: #16a085;
color: #FFF;
font-weight: 400;
text-transform: uppercase;
}We also want to give the button some hover effects to call the user to action.
Challenge 13
-
Using the
:hoverpseudo selector 2. Set theopacityto0.83. give abox-shadowof:0 2px 4px rgba(0, 0, 0, 0.4)4. set thetransitionproperty to0.1s ease -
Refresh and check it out
-
Now use the
:activepseudo selector to: 7. apply anopacityof18. and abox-shadowof0 1px 2px rgba(0, 0, 0, 0.4)
Challenge 13 Answer:
.sign-up-button:hover {
opacity: 0.8;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
transition: 0.1s ease;
}
.sign-up-button:active {
opacity: 1;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}Let's put the finishing touches on this side.
Challenge 14 - Using a :focus pseudo selector, apply the following code to input:
border-bottom: 2px solid #16a085;
color: #16a085;
transition: 0.2s ease;Once complete, you'll want to modify focus on the entire document.
Place the following code near the top of your stylesheet
*:focus {
outline: none;
}At the end of your styling you should have the following code for your left <div>
h1 {
margin: 0 0 20px 0;
font-weight: 300;
font-size: 2em;
}
.sign-up input {
border: none;
border-bottom: 1px solid #AAA;
display: block;
margin-bottom: 20px;
padding: 4px;
width: 220px;
height: 32px;
font-weight: 400;
/*transition: 0.2s ease*/
}
.sign-up input:focus
{
border-bottom: 2px solid #16a085;
color: #16a085;
transition: 0.2s ease;
}
.sign-up-button {
margin: 5px auto;
width: 220px;
height: 32px;
border: none;
border-radius: 2px;
background: #16a085;
color: #FFF;
font-weight: 400;
text-transform: uppercase;
}
.sign-up-button:hover {
opacity: 0.8;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
transition: 0.1s ease;
}
.sign-up-button:active {
opacity: 1;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}Challenge 15 - style the <span>
- Set the display of your 'logmein' class to
block - Give it a margin bottom of
40px - Assign a
font-sizeof2em - Give a color of
#FFF - Center the text
This is what you're looking for:

Challenge 15 Answer:
.loginwith {
display: block;
margin-bottom: 40px;
font-size: 2em;
color: #FFF;
text-align: center;
}Got it! Awesome, now let's style those buttons.
Challenge 16 - Style ALL buttons
- give a margin bottom of
20px - width of
220px - height of
36px - remove the border
- give a
border-radiusof2px - set the text color to
#FFF
Challenge 16 Answer:
button.social-signin {
margin-bottom: 20px;
width: 220px;
height: 36px;
border: none;
border-radius: 2px;
color: #FFF;
}You may notice some code duplication. Let's go ahead and refactor
Challenge 17 - Refactor the buttons!
- Group the buttons (from your left and right
<div>'s together in your css - Refresh and make sure everything looks good
- Refactor the code duplication
When it's all said and done, you should have something similar to this:
/**********************************************
start of button styling
/**********************************************/
button {
margin-bottom: 20px;
width: 220px;
height: 36px;
border: none;
border-radius: 2px;
color: #FFF;
font-weight: 400;
}
button:hover {
opacity: 0.8;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
transition: 0.1s ease;
}
button:active {
opacity: 1;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.sign-up-button {
margin: 5px auto;
background: #16a085;
text-transform: uppercase;
}
/**********************************************
end of button styling
/**********************************************/That kept the styling of the 'left' <button>. Now let's add some color to the right <button>'s
Challenge 18 - Add some color to the right buttons
- Apply the following background colors
2. for the facebook class:
#32508E3. twitter class:#55ACEE4. google class:#DD4B39 - Refresh!
**Challenge 18 Answer:**
.facebook {
background: #32508E;
}
.twitter {
background: #55ACEE;
}
.google {
background: #DD4B39;
}We're close to the end. Let's style that 'or' class
Challenge 19
- Give a
positionofabsolute - set it to:
3.
180pxfrom top 3.280pxfrom left - Assign a
widthof40px - Give a
heightof40px - Refresh!
.or {
position: absolute;
top: 180px;
left: 280px;
width: 40px;
height: 40px;
}Okay, not exactly what we're looking for. Now try this:
Challenge 20
- Set the background to
#DDD - give a
border-radiusof50% - center the text
- set a
line-heightof40px - declare a
box-shadowof0 2px 4px rgba(0, 0, 0, 0.4)
.or {
position: absolute;
top: 180px;
left: 280px;
width: 40px;
height: 40px;
background: #DDD;
border-radius: 50%;
text-align: center;
line-height: 40px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}Refresh and enjoy the fruits of your labor... Which should look something like this:
* {
box-sizing: border-box;
}
@import url(https://fonts.googleapis.com/css?family=Noto+Sans|Comfortaa:400,300,700);
*:focus {
outline: none;
}
body {
background: #DDD;
color: #222;
font-family: 'Noto Sans', sans-serif;
font-weight: 300;
}
#login-box {
position: relative;
margin: 5% auto;
width: 600px;
height: 400px;
background: #FFF;
border-radius: 2px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
/**********************************************
Left and Right div Positioning
/**********************************************/
.left, .right {
padding: 40px;
width: 300px;
height: 400px;
position: absolute;
top: 0
}
.left {
left: 0;
}
.right {
right: 0;
background: url('https://goo.gl/YbktSj');
background-size: cover;
background-position: center;
border-radius: 0 2px 2px 0;
}
/**********************************************
END div positioning
/**********************************************/
/**********************************************
Left div styling
/**********************************************/
h1 {
margin: 0 0 20px 0;
font-weight: 300;
font-size: 2em;
}
.sign-up input {
border: none;
border-bottom: 1px solid #AAA;
display: block;
margin-bottom: 20px;
padding: 4px;
width: 220px;
height: 32px;
font-weight: 400;
/*transition: 0.2s ease*/
}
.sign-up input:focus {
border: none;
border-bottom: 2px solid #16a085;
color: #16a085;
transition: 0.2s ease;
}
/**********************************************
end of left div styling
/**********************************************/
/**********************************************
start of button styling
/**********************************************/
button {
margin-bottom: 20px;
width: 220px;
height: 36px;
border: none;
border-radius: 2px;
color: #FFF;
font-weight: 400;
}
button:hover {
opacity: 0.8;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
transition: 0.1s ease;
}
button:active {
opacity: 1;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.sign-up-button {
margin: 5px auto;
background: #16a085;
text-transform: uppercase;
}
.facebook {
background: #32508E;
}
.twitter {
background: #55ACEE;
}
.google {
background: #DD4B39;
}
/**********************************************
end of button styling
/**********************************************/
.loginwith {
display: block;
margin-bottom: 40px;
font-size: 2em;
color: #FFF;
text-align: center;
}
.or {
position: absolute;
top: 180px;
left: 280px;
width: 40px;
height: 40px;
background: #DDD;
border-radius: 50%;
text-align: center;
line-height: 40px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}








