Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 80 additions & 25 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<!-- write your html here-->
<!--
try writing out the requirements first as comments
this will also help you fill in your PR message later-->
</form>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
</footer>
</body>
</html>

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="T-Shirt Order Form" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>

<body>
<header>
<link rel="stylesheet" href="styles.css">
<h1>Product Pick</h1>
</header>
<main>
<form>
<!-- Customer Name Input -->
<p>
<label for="customerName">Name:</label>
<input type="text" id="customerName" name="customerName" required minlength="2" pattern=".*\S.*\S.*"
placeholder="Enter your full name">
</p>

<!-- Customer Email Input -->
<p>
<label for="emailAddress">Email:</label>
<input type="email" id="emailAddress" name="emailAddress" required placeholder="you@gmail.com"
pattern="^[a-zA-Z0-9]([a-zA-Z0-9._%+\-]*[a-zA-Z0-9])?@[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)+$"
title="Please enter a valid email address (e.g., user@gmail.com). Domain parts (like 'gmail') must start and end with a letter or number, can contain hyphens, and must be separated by dots. Ends with a top-level domain (e.g., .com).">
</p>

<!-- T-Shirt Colour Selection -->
<fieldset>
<legend>Choose T-Shirt Colour:</legend>
<p>
<label>
<input type="radio" name="shirt-colour" value="red" required>
Red
</label>
</p>
<p>
<label>
<input type="radio" name="shirt-colour" value="blue" required>
Blue
</label>
</p>
<p>
<label>
<input type="radio" name="shirt-colour" value="green" required>
Green
</label>
</p>
</fieldset>

<!-- T-Shirt Size Selection -->
<p>
<label for="shirtSize">Choose Size:</label>
<select id="shirtSize" name="shirtSize" required>
<option value="">-- Please choose a size --</option>
<option value="xs">XS</option>
<option value="s">S</option>
<option value="m">M</option>
<option value="l">L</option>
<option value="xl">XL</option>
<option value="xxl">XXL</option>
</select>
</p>

<!-- Submit Section Button -->
<p>
<button type="submit">Place Order</button>
</p>
</form>
</main>
<footer>
<h2>By Gideon Defar</h2>
</footer>
</body>

</html>
138 changes: 138 additions & 0 deletions Form-Controls/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/* ====== Form Layout ====== */
body {
font-family: system-ui, sans-serif;
font-size: 16px;
line-height: 1.5;
background: #f5f5f4;
color: #1a1a18;
margin: 0;
padding: 0;
}

header {
text-align: center;
padding: 2rem 1rem 0;
}

header h1 {
font-size: 22px;
font-weight: 500;
margin: 0;
}

main {
max-width: 480px;
margin: 2rem auto;
background: #ffffff;
border: 1px solid #e0dfd8;
border-radius: 12px;
padding: 2rem;
}

/* ====== Labels ====== */
label {
display: block;
font-size: 14px;
color: #5f5e5a;
margin-bottom: 4px;
}

/* ====== Text & Email Inputs ====== */
input[type="text"],
input[type="email"] {
width: 100%;
box-sizing: border-box;
padding: 8px 12px;
font-size: 15px;
border: 1px solid #b4b2a9;
border-radius: 8px;
background: #f5f5f4;
color: #1a1a18;
}

input[type="text"]:focus,
input[type="email"]:focus {
outline: none;
box-shadow: 0 0 0 2px #85b7eb;
border-color: #378add;
}

/* ====== Select Dropdown ====== */
select {
width: 100%;
box-sizing: border-box;
padding: 8px 12px;
font-size: 15px;
border: 1px solid #b4b2a9;
border-radius: 8px;
background: #f5f5f4;
color: #1a1a18;
}

select:focus {
outline: none;
box-shadow: 0 0 0 2px #85b7eb;
border-color: #378add;
}

/* ====== Fieldset & Legend ====== */
fieldset {
border: 1px solid #e0dfd8;
border-radius: 8px;
padding: 1rem 1.25rem;
margin: 0 0 1rem;
}

legend {
font-size: 14px;
color: #5f5e5a;
padding: 0 6px;
}

/* ====== Radio Buttons ====== */
fieldset label {
display: flex;
align-items: center;
gap: 10px;
font-size: 15px;
color: #1a1a18;
cursor: pointer;
}

input[type="radio"] {
accent-color: #378add;
width: 16px;
height: 16px;
flex-shrink: 0;
}

/* ====== Paragraph spacing ====== */
form p {
margin: 0 0 1rem;
}

/* ====== Submit Button ====== */
button[type="submit"] {
width: 100%;
padding: 10px;
font-size: 15px;
font-weight: 500;
background: #378add;
color: #ffffff;
border: none;
border-radius: 8px;
cursor: pointer;
margin-top: 0.5rem;
}

button[type="submit"]:hover {
background: #185fa5;
}

/* ====== Footer ====== */
footer {
text-align: center;
font-size: 13px;
color: #5f5e5a;
padding: 1rem;
}
Loading