score: 100/100
instructions
Create a simple sign-up form using HTML forms and apply basic styling using CSS. Upload the screenshots of (a) source code and (b) output (in a PDF file format) to the Google Classroom.
file structure
index.html
style.css
code
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Laboratory 2</title>
</head>
<body>
<form action="submit_form.php" method="post">
<div class="form-group">
<label for="fname">First Name</label>
<input type="text" id="fname" name="fname" placeholder="e.g., Juan" required>
</div>
<div class="form-group">
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lname" placeholder="e.g., Dela Cruz" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" name="email" placeholder="e.g., juandelacruz@example.com" required>
</div>
<div class="form-group">
<label for="dob">Date of Birth</label>
<input type="date" id="dob" name="dob" required>
</div>
<div class="form-group">
<label>Gender</label>
<input type="radio" id="male" name="gender" value="male" required>
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female" required>
<label for="female">Female</label>
</div>
<div class="form-group">
<label for="address">Address</label>
<textarea name="address" id="address" rows="3" placeholder="e.g., Street Name, Barangay, City, Province" required></textarea>
</div>
<div class="form-group">
<label for="country">Country</label>
<select id="country" name="country" required>
<option value="" disabled selected>Select your country</option>
<option value="PH">Philippines</option>
<option value="ID">Indonesia</option>
<option value="MY">Malaysia</option>
<option value="MM">Myanmar</option>
<option value="SG">Singapore</option>
<option value="TH">Thailand</option>
<option value="VN">Vietnam</option>
</select>
</div>
<input type="checkbox" id="terms" name="terms" required>
<label for="terms">Agree to the <a href="">Terms and Conditions</a></label>
<button type="submit">Sign Up</button>
</form>
</body>
</html>@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Poppins', sans-serif;
background-color: #fafafa;
color: #171717;
}
form {
margin: 5rem auto;
max-width: 330px;
padding: 1rem;
border-radius: 8px;
border: 2px solid #ebebeb;
background-color: #fff;
}
h2 {
text-align: center;
}
form .form-group:nth-child(1) {
margin: 0;
}
textarea {
resize: none;
width: 100%;
}
button {
font-weight: 500;
font-size: 0.875rem;
line-height: 1.25rem;
color: white;
margin-top: 1rem;
padding: 0.5rem 1rem;
width: 100%;
border-radius: 6px;
border: none;
background-color: #0072f5;
}
.form-group {
margin: 1rem 0;
}
input[type='text'],
input[type='email'],
input[type='date'] {
width: 100%;
}
label {
display: block;
margin-right: 0.5rem;
font-weight: 500;
font-size: 0.875rem;
line-height: 1.25rem;
}
a {
color: #52aeff;
text-decoration: underline;
}
a:active {
color: red;
}
label[for='terms'] {
display: inline;
font-size: 0.75rem;
line-height: 1rem;
width: 100%;
margin-left: 0.25rem;
user-select: none;
}
textarea::placeholder,
input::placeholder {
color: #cbcbcb;
}
textarea,
select,
input {
padding: 0.5rem;
background-color: #fafafa;
border: 1px solid #ebebeb;
border-radius: 6px;
color: #666;
}
textarea:hover,
select:hover,
input:hover {
background-color: #f7f7f7;
border: 1px solid #c9c9c9;
}
textarea:focus,
select:focus,
input:focus {
outline: #cce6ff solid 2px;
}
input[type='radio']:focus,
input[type='checkbox']:focus {
outline: none;
}
input[type='radio'],
label[for='male'],
label[for='female'] {
display: inline;
font-weight: 400;
color: #666;
}