Skip to content
Open
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
66 changes: 54 additions & 12 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,63 @@
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>

<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you check to make sure you have the closing </main> tag?

<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-->
<h2>By HOMEWORK SOLUTION</h2>
</footer>
</body>
<form>
<fieldset>
<legend><h2> Customer's details:</h2></legend>

<label for="name"> Name</label>
<input type="text" name="name" id="name" required pattern=".*\S.*" title="Name cannot be empty or contain only spaces.">


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

<fieldset>
<legend><h2> Choose a T-Shirt</h2></legend>

<label for="color">Color</label>
<select name="color" id="color" required>
<option value=""> Select </option>
<option value="red">Red</option>
<option value="white">White</option>
<option value="black">Black</option>
</select>

<p>Size</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Your radio button labels and input work, but it is a bit unusual to have the label first and then the input.
For radio buttons, having the input defined first will be a bit more intuitive for users.
Here is an example: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/radio#try_it

If you wrap your radio buttons inside of a <fieldset> and use a <legend>, then a screen reader will be able to announce the <legend> text along with each radio button, providing context to your user.


<input type="radio" name="size" id="xs" value="xs">
<label for="xs">XS</label>
<br>
<input type="radio" name="size" id="s" value="s">
<label for="s">S</label>
<br>
<input type="radio" name="size" id="m" value="m">
<label for="m">M</label>
<br>
<input type="radio" name="size" id="l" value="l">
<label for="l">L</label>
<br>
<input type="radio" name="size" id="xl" value="xl">
<label for="xl">XL</label>
<br>
<input type="radio" name="size" id="xxl" value="xxl">
<label for="xxl">XXL</label>
<br>
</fieldset>

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

<footer>
<p> ping wang </p>
</footer>
</body>
</html>
Loading