Skip to content
81 changes: 81 additions & 0 deletions Form-Controls/Untitled-1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* 1. Reset defaults and center everything on the page */
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f4f7f6;
margin: 0;
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
box-sizing: border-box;
}

h1 {
color: #2c3e50;
margin-bottom: 20px;
font-size: 2rem;
}

.form {
background-color: #ffffff;
padding: 30px;
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
width: 100%;
max-width: 400px;
box-sizing: border-box;
}

.form > div {
margin-bottom: 20px;
display: flex;
flex-direction: column;
}

label {
font-size: 0.85rem;
font-weight: 600;
color: #34495e;
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
select {
padding: 10px 14px;
font-size: 1rem;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #fff;
color: #333;
outline: none;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
border-color: #3498db;
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

button {
background-color: #366280;
color: white;
border: none;
padding: 12px;
font-size: 1rem;
font-weight: 600;
border-radius: 4px;
cursor: pointer;
width: 100%;
transition: background-color 0.2s ease;
margin-top: 10px;
}

button:hover {
background-color: #2980b9;
}
77 changes: 53 additions & 24 deletions Form-Controls/index.html

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see 3 errors when checking the file in the w3 validator. How can you fix them?

Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
<!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>
<head>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My form exercise work</title>
<link rel="stylesheet" href="Untitled-1.css">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What else could you use as file name for the stylesheet to adhere more to standard naming?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Did you see this comment?

</head>

<body>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Where does the body end?

<h1>PRODUCT PICK</h1>

<form action="T-shirt.html" method="GET" class="form">

<div>
<label for="name">NAME</label>
<input type="text" name="name" id="name" placeholder="name" value="name" minlength="2" maxlength="100" required>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The formatting standard for HTML elements is to use indentation on children elements. This makes it easier to understand the structure. How can you ensure consistent formatting in your code automatically?


<div>

<label for="email">EMAIL</label>
<input type="email" name="email" id="email" placeholder="email" value="email" required>
</div>

<div>
colour of T-shirt
<label for="colour">colour of T-shirt</label>
<select name="colour" id="colour">
<option value="red">red</option>
<option value="blue">blue</option>
<option value="green">green</option>
</select>
</div>

<div>
size of T-shirt
<label for="size">size of T-shirt</label>

<select name="size" id="size" required>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The XS option is missing here

<option value="XS">XS</option>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is an error in the w3 validator:
Error: The first child option element of a select element with a required attribute, and without a multiple attribute, and without a size attribute whose value is greater than 1, must have either an empty value attribute, or must have no text content. Consider either adding a placeholder option label, or adding a size attribute with a value equal to the number of option elements.

<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>Submit</button>
</form>
</body>
</html>


Loading