|
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 | + <style> |
| 10 | + body { |
| 11 | + font-family: Arial, sans-serif; |
| 12 | + margin: 0; |
| 13 | + padding: 0; |
| 14 | + } |
| 15 | + header { |
| 16 | + color: black; |
| 17 | + padding: 1rem; |
| 18 | + text-align: center; |
| 19 | + margin-bottom: 20px; |
| 20 | + } |
| 21 | + main { |
| 22 | + padding: 1rem; |
| 23 | + } |
| 24 | + form { |
| 25 | + max-width: 400px; |
| 26 | + margin: 0 auto; |
| 27 | + } |
| 28 | + div { |
| 29 | + margin-bottom: 1rem; |
| 30 | + } |
| 31 | + label { |
| 32 | + display: block; |
| 33 | + margin-bottom: 0.5rem; |
| 34 | + } |
| 35 | + input, |
| 36 | + select { |
| 37 | + width: 100%; |
| 38 | + padding: 0.5rem; |
| 39 | + box-sizing: border-box; |
| 40 | + } |
| 41 | + button { |
| 42 | + padding: 0.5rem 1rem; |
| 43 | + background-color: #333; |
| 44 | + color: white; |
| 45 | + border: none; |
| 46 | + cursor: pointer; |
| 47 | + } |
| 48 | + |
| 49 | + </style> |
9 | 50 | </head> |
10 | 51 | <body> |
11 | 52 | <header> |
12 | 53 | <h1>Product Pick</h1> |
13 | 54 | </header> |
14 | 55 | <main> |
15 | 56 | <form> |
16 | | - <!-- write your html here--> |
17 | | - <!-- |
18 | | - try writing out the requirements first as comments |
| 57 | + |
| 58 | + <div> |
| 59 | + |
| 60 | + <label for="name"> Name:</label> |
| 61 | + <input type="text" id="name" name="name" required pattern="\S{2,}" title="Please enter at least two non-space characters."> |
| 62 | + </div> |
| 63 | + |
| 64 | + <div> |
| 65 | + <label for="email"> Email:</label> |
| 66 | + <input type="email" id="email" name="email" required> |
| 67 | + </div> |
| 68 | + <div> |
| 69 | + <label for="color"> Colour:</label> |
| 70 | + <select id="color" name="color" required> |
| 71 | + <option value="">Please select a colour</option> |
| 72 | + <option value="red">Red</option> |
| 73 | + <option value="blue">Blue</option> |
| 74 | + <option value="green">Green</option> |
| 75 | + </select> |
| 76 | + </div> |
| 77 | + <div> |
| 78 | + <label for="size"> Size:</label> |
| 79 | + <select id="size" name="size" required> |
| 80 | + <option value="">Please select a size</option> |
| 81 | + <option value="xs">XS</option> |
| 82 | + <option value="s">S</option> |
| 83 | + <option value="m">M</option> |
| 84 | + <option value="l">L</option> |
| 85 | + <option value="xl">XL</option> |
| 86 | + <option value="xxl">XXL</option> |
| 87 | + </select> |
| 88 | + </div> |
| 89 | + <div> |
| 90 | + <button type="submit">Submit</button> |
| 91 | + </div> |
| 92 | + <!-- |
19 | 93 | this will also help you fill in your PR message later--> |
| 94 | + <!-- |
| 95 | + What is the customer's name? I must collect this data and ensure it contains at least two non-space characters. |
| 96 | + What is the customer's email? I must make sure the email is valid. Email addresses follow a consistent pattern. |
| 97 | + What colour should this T-shirt be? I must provide 3 options. How will I ensure they do not choose other colours? |
| 98 | + What size does the customer want? I must provide the following 6 options: XS, S, M, L, XL, XXL --> |
20 | 99 | </form> |
21 | 100 | </main> |
22 | 101 | <footer> |
23 | 102 | <!-- change to your name--> |
24 | | - <p>By HOMEWORK SOLUTION</p> |
| 103 | + <p>By Russom G</p> |
25 | 104 | </footer> |
26 | 105 | </body> |
27 | 106 | </html> |
0 commit comments