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
72 changes: 63 additions & 9 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,79 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="" />
<title>T-shirt Order Form</title>
<meta name="description" content="Choose your T-shirt colour and size." />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="styles.css" />
</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 aria-label="T-shirt order form">
<div class="form-group">
<label for="customer-name">Name</label>
<input
id="customer-name"
name="customer-name"
type="text"
pattern=".*\S.*\S.*"
title="Please enter at least two non-space characters."
required
/>
</div>

<div class="form-group">
<label for="customer-email">Email</label>
<input
id="customer-email"
name="customer-email"
type="email"
required
/>
</div>

<fieldset class="form-group">
<legend>Choose a colour</legend>
<div class="radio-group">
<label class="option">
<input name="tshirt-colour" type="radio" value="red" required />
<span>Red</span>
</label>

<label class="option">
<input name="tshirt-colour" type="radio" value="blue" />
<span>Blue</span>
</label>

<label class="option">
<input name="tshirt-colour" type="radio" value="black" />
<span>Black</span>
</label>
</div>
</fieldset>

<div class="form-group">
<label for="tshirt-size">Choose a size</label>
<select id="tshirt-size" name="tshirt-size" required>
<option value="" selected disabled>Select 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>
</div>

<button type="submit">Order now</button>
</form>
</main>

<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
<p>By Brian</p>
</footer>
</body>
</html>
139 changes: 139 additions & 0 deletions Form-Controls/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
* {
box-sizing: border-box;
}

:root {
--bg: #f5f7fb;
--surface: #ffffff;
--border: #d9deea;
--text: #1a2433;
--muted: #475569;
--accent: #2d6cdf;
--accent-soft: #eaf1ff;
--shadow: rgba(15, 23, 42, 0.08);
}

body {
margin: 0;
min-height: 100vh;
font-family: Arial, Helvetica, sans-serif;
background: linear-gradient(180deg, var(--bg), #edf3ff);
color: var(--text);
}

header {
padding: 2rem 1rem 0;
}

h1 {
text-align: center;
margin: 0;
font-size: clamp(2rem, 3vw, 3rem);
}

main {
display: flex;
justify-content: center;
padding: 2rem 1rem 3rem;
}

form {
width: min(100%, 620px);
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
box-shadow: 0 12px 30px var(--shadow);
padding: 2rem;
}

.form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 1.5rem;
}

label {
font-weight: 700;
color: var(--text);
}

input,
select,
button {
font: inherit;
}

input[type='text'],
input[type='email'],
select {
width: 100%;
padding: 0.8rem 0.9rem;
border: 1px solid var(--border);
border-radius: 10px;
background: #fff;
color: var(--text);
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type='text']:focus,
input[type='email']:focus,
select:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-soft);
}

.radio-group {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 0.75rem;
}

.option {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 0.9rem;
border: 1px solid var(--border);
border-radius: 10px;
background: #fafbff;
}

.option input {
margin: 0;
}

button {
width: 100%;
padding: 0.9rem 1.25rem;
border: none;
border-radius: 10px;
background: var(--accent);
color: #fff;
font-weight: 700;
cursor: pointer;
transition: background 0.2s ease, transform 0.2s ease;
}

button:hover {
background: #1d57bc;
transform: translateY(-1px);
}

button:focus-visible {
outline: 3px solid #a4c2ff;
outline-offset: 2px;
}

footer {
text-align: center;
padding: 1rem;
color: var(--muted);
}

@media (max-width: 480px) {
form {
padding: 1.25rem;
}
}
Loading