|
6 | 6 | <title>My form exercise</title> |
7 | 7 | <meta name="description" content="" /> |
8 | 8 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 9 | + <link rel="stylesheet" href="style.css"> |
9 | 10 | </head> |
10 | 11 | <body> |
11 | 12 | <header> |
12 | 13 | <h1>Product Pick</h1> |
13 | 14 | </header> |
14 | 15 | <main> |
15 | | - <form> |
| 16 | + <form action="#" method="POST"> |
16 | 17 | <div> |
17 | | - <label for="name">Name</label> |
18 | | - <input type="text" name="name" id"Name" placeholder="name" required> |
| 18 | + <label for="name">Name</label> |
| 19 | + <input type="text" name="name" id="name" placeholder="name" pattern="(\s*[^\s]\s*){2,}" title="Name must contain at least two letters or characters." required> |
19 | 20 | </div> |
20 | 21 | <div> |
21 | | - <lable type="text" for= "email">email</lable> |
22 | | - <input type="email" id="email" size="30" required /> |
| 22 | + <label for="email">Email</label> |
| 23 | + <input type="email" name="email" id="email" size="30" required /> |
23 | 24 | </div> |
24 | | - <p>Please select favourite colour:</p> |
25 | | - <input type="radio" id="red" name="fav_color" value"red"> |
26 | | - <label for="red">Red</label><br> |
27 | | - <input type="radio" id="blue" name="fav_color" value"blue"> |
28 | | - <label for="blue">Blue</label><br> |
29 | | - <input type="radio" id="green" name="fav_color" value"green"> |
30 | | - <label for="green">Green</label><br> |
| 25 | + <fieldset> |
| 26 | + <legend>Please select favourite colour:</legend> |
| 27 | + <input type="radio" class="colour" id="red" name="fav_color" value="red"> |
| 28 | + <label for="red">Red</label><br> |
| 29 | + <input type="radio" class="colour" id="blue" name="fav_color" value="blue"> |
| 30 | + <label for="blue">Blue</label><br> |
| 31 | + <input type="radio" class="colour" name="fav_color" id="green" value="green"> |
| 32 | + <label for="green">Green</label><br> |
| 33 | + </fieldset> |
31 | 34 | <div> |
32 | | - <p> Please select your relevant size</p> |
33 | | - <label for="clothing-size">Choose a size:</label> |
34 | | - <select id="clothing-size" name="size"> |
35 | | - <option value="xs"> XS - Extra Small</option> |
36 | | - <option value="s">S - Small</option> |
37 | | - <option value="m" selected>M - Medium</option> |
38 | | - <option value="l">L - Large</option> |
39 | | - <option value="xl">XL - Extra Large</option> |
40 | | - </select> |
| 35 | + <p>Please select your relevant size</p> |
| 36 | + <label for="clothing-size">Choose a size:</label> |
| 37 | + <!-- Added a placeholder option and a 6th size (XXL) --> |
| 38 | + <select id="clothing-size" name="size" required> |
| 39 | + <option value="" disabled selected hidden>-- Select a size --</option> |
| 40 | + <option value="xs">XS - Extra Small</option> |
| 41 | + <option value="s">S - Small</option> |
| 42 | + <option value="m">M - Medium</option> |
| 43 | + <option value="l">L - Large</option> |
| 44 | + <option value="xl">XL - Extra Large</option> |
| 45 | + <option value="xxl">XXL - Double Extra Large</option> |
| 46 | + </select> |
41 | 47 | </div> |
42 | 48 | <button type="reset">Reset</button> |
43 | 49 | <button type="submit">Submit</button> |
44 | | - </form> |
| 50 | + </form> |
45 | 51 | </main> |
46 | 52 | <footer> |
47 | | - <!-- change to your name--> |
48 | | - <p>By HOMEWORK SOLUTION</p> |
| 53 | + <p>By HOMEWORK SOLUTION</p> |
49 | 54 | </footer> |
50 | 55 | </body> |
51 | 56 | </html> |
0 commit comments