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
78 changes: 71 additions & 7 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,89 @@
<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="T-shirt order form" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="style.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-->
<!-- NAME -->
<div>
<label for="name">Full Name</label>
<input
type="text"
id="name"
name="name"
value=""
required
minlength="2"
pattern=".*\S.*\S.*"
/>
</div>

<!-- EMAIL -->
<div>
<label for="email">Email Address</label>
<input
type="email"
id="email"
name="email"
value=""
required
/>
</div>

<!-- COLOUR -->
<fieldset>
<legend>Choose a colour</legend>

<label>
<input type="radio" name="colour" value="red" required />
Red
</label>

<label>
<input type="radio" name="colour" value="purple" />
Purple
</label>

<label>
<input type="radio" name="colour" value="black" />
Black
</label>

</fieldset>

<!-- SIZE -->
<div>
<label for="size">Choose a size</label>
<select id="size" name="size" required>
<option value="">-- 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>

<!-- SUBMIT -->
<div>
<button type="submit">Place Order</button>
</div>

</form>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
<p>By Alina Sofragiu</p>
</footer>
</body>
</html>
119 changes: 119 additions & 0 deletions Form-Controls/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/* RESET */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}

/* PAGE */
body {
background-color: #f7f7f7;
color: #333; /* high contrast for accessibility */
line-height: 1.5;
padding: 20px;
}

/* HEADER */
header h1 {
text-align: center;
font-weight: 500;
margin-bottom: 20px;
}

/* MAIN CONTAINER */
main {
max-width: 520px;
margin: 40px auto;
background: #fff;
padding: 25px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

/* FORM ELEMENT SPACING */
form div,
fieldset {
margin-bottom: 16px;
}

/* LABELS */
label {
display: block;
margin-bottom: 6px;
font-size: 0.95rem;
color: #333;
}

/* INPUT + SELECT */
input,
select {
width: 100%;
padding: 10px;
border: 1px solid #bbb;
border-radius: 6px;
font-size: 1rem;
background: #fff;
color: #333;
}

/* FOCUS STATES (IMPORTANT FOR ACCESSIBILITY SCORE 100) */
input:focus,
select:focus {
outline: 3px solid #000;
outline-offset: 2px;
}

/* FIELDSET */
fieldset {
border: 1px solid #ddd;
border-radius: 6px;
padding: 10px;
}

/* LEGEND */
legend {
padding: 0 6px;
font-weight: 500;
}

/* RADIO OPTIONS */
fieldset label {
display: inline-flex;
align-items: center;
margin-right: 15px;
font-size: 0.95rem;
cursor: pointer;
}

fieldset input {
margin-right: 6px;
}

/* BUTTON */
button {
width: 100%;
padding: 12px;
border: none;
border-radius: 6px;
background-color: #333;
color: #fff;
font-size: 1rem;
cursor: pointer;
}

/* BUTTON HOVER + FOCUS */
button:hover,
button:focus {
background-color: #555;
outline: 3px solid #000;
outline-offset: 2px;
}

/* FOOTER */
footer {
text-align: center;
margin-top: 20px;
font-size: 0.85rem;
color: #444; /* improved contrast */
}
Loading