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
117 changes: 92 additions & 25 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,94 @@
<!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="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="style.css">

</head>

<body>
<header>
<h1>Product T-shirts</h1>
</header>
<main>
<form>


<!-- 1. What is the customer's name? I must collect this data and ensure it contains at least two non-space characters. -->

<label for="username">Name</label>
<input type="text" id="username" pattern=".*\S.*\S.*" required autocomplete="name">

<!-- 2. What is the customer's email? I must make sure the email is valid. Email addresses follow a consistent pattern. -->

<label for="email">Email</label>
<input type="email" id="email" required autocomplete="email">

<!-- 3. What colour should this T-shirt be? I must provide 3 options. How will I ensure they do not choose other colours? -->

<fieldset>

<legend>Choose a colour</legend>

<label>
Red
<input type="radio" name="colour" value="red" required>
</label>
Comment on lines +38 to +41
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you wondered whether the text should appear on the left or on the right of the radio button?

Do use an AI tool to research the advantages and disadvantages of placing radio buttons on the left versus the right of their corresponding labels.

No change required.


<label>
Green
<input type="radio" name="colour" value="green">
</label>

<label>
White
<input type="radio" name="colour" value="white">
</label>

</fieldset>

<!-- 4. What size does the customer want? I must provide the following 6 options: XS, S, M, L, XL, XXL -->

<fieldset>
<legend>Choose a size</legend>

<label for="xs">XS</label>
<input type="radio" id="xs" name="size" value="xs" required>

<label for="s">S</label>
<input type="radio" id="s" name="size" value="s" required>

<label for="m">M</label>
<input type="radio" id="m" name="size" value="m" required>

<label for="l">L</label>
<input type="radio" id="l" name="size" value="l" required>

<label for="xl">XL</label>
<input type="radio" id="xl" name="size" value="xl" required>

<label for="xxl">XXL</label>
<input type="radio" id="xxl" name="size" value="xxl" required>


</fieldset>

<button type="submit">Submit</button>




</form>
</main>
<footer>

<p>Made with love by Abid Akhtar</p>
</footer>
</body>

</html>
75 changes: 75 additions & 0 deletions Form-Controls/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: beige;
}

header,
footer {
text-align: center;
margin-bottom: 20px;
}

h1 {
margin-bottom: 10px;
}

main {
display: flex;
justify-content: center;
}

form {
background-color: white;
padding: 20px;
border-radius: 8px;
width: 100%;
max-width: 450px;

display: flex;
flex-direction: column;
gap: 16px;
}

label {
font-weight: bold;
}

input[type="text"],
input[type="email"] {
width: 100%;
padding: 10px;
font-size: 16px;
box-sizing: border-box;
}

fieldset {
border: 1px solid #ccc;
padding: 16px;
}

legend {
font-weight: bold;
padding: 0 6px;
}

fieldset label {
font-weight: normal;
margin-right: 6px;
}

fieldset input[type="radio"] {
margin-right: 16px;
margin-bottom: 10px;
}

button {
padding: 12px;
font-size: 16px;
cursor: pointer;
}

footer p {
font-size: 14px;
}
Loading