Skip to content

Commit 7ec221f

Browse files
authored
used a validator for HTML
1 parent b3b1bc8 commit 7ec221f

1 file changed

Lines changed: 34 additions & 35 deletions

File tree

‎Form-Controls/index.html‎

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="utf-8" />
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<title>My form exercise</title>
7-
<link rel="stylesheet" href="style.css"/>
8-
<meta name="description" content="" />
9-
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<link rel="stylesheet" href="style.css">
8+
<meta name="description" content="">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
1010
</head>
1111
<body>
1212
<header>
@@ -16,7 +16,7 @@ <h1>Product Pick</h1>
1616
<form>
1717

1818
Enter your name:
19-
<input type="text" placeholder="Enter your name " name="aName" size="16" minlength="2" maxlength="16" PATTERN = ".*\S.*\S.*" required>
19+
<input type="text" placeholder="Enter your name " name="aName" size="16" minlength="2" maxlength="16" pattern=".*\S.*\S.*" required>
2020

2121
<!-- the size attribute control how wide the text box, "how many characters it can control-->
2222
<!-- the minlength attribute control the minimum number of characters required-->
@@ -27,47 +27,46 @@ <h1>Product Pick</h1>
2727
<!-- choosing the radio buttons for color selection-->
2828
<p>please select a color:</p>
2929
<p>
30-
<input type="radio" name="color" id="red" value="Red" placeholder="Red" required>
31-
<label for="red"label>Red</label><br>
32-
<input type="radio" name="color" id="brown" value="Brown" placeholder="Brown" required>
30+
<input type="radio" name="color" id="red" value="Red" required>
31+
<label for="red">Red</label>
32+
<input type="radio" name="color" id="brown" value="Brown" required>
3333
<label for="brown">Brown</label><br>
34-
<input type="radio" name="color" id="black" value="Black" placeholder="Black" required>
34+
<input type="radio" name="color" id="black" value="Black" required>
3535
<label for="black">Black</label><br>
3636
</p>
3737

3838
<!-- a list of suggestions using the list attribute and the datalist element -->
3939

40-
<label>
41-
Select your T-shirt size:
42-
<p>please select a size:</p>
43-
<p>
44-
<input type="radio" name="T-shirt_Size" id="XS" value="XS" placeholder="XS" required>
45-
<label for="XS"label>xs</label><br>
46-
<input type="radio" name="T-shirt_Size" id="S" value="S" placeholder="S" required>
47-
<label for="S"label>s</label><br>
48-
<input type="radio" name="T-shirt_Size" id="M" value="M" placeholder="M" required>
49-
<label for="M"label>M</label><br>
50-
<input type="radio" name="T-shirt_Size" id="L" value="L" placeholder="L" required>
51-
<label for="L"label>L</label><br>
52-
<input type="radio" name="T-shirt_Size" id="XL" value="XL" placeholder="XL" required>
53-
<label for="XL"label>XL</label><br>
54-
<input type="radio" name="T-shirt_Size" id="XXL" value="XXL" placeholder="XXL" required>
55-
<label for="XXL"label>xXXL/label><br>
56-
</p>
57-
</label>
40+
<p>Select your T-shirt size:</p>
41+
 
42+
<input type="radio" name="T-shirt_Size" id="XS" value="XS" required>
43+
<label for="XS">XS</label><br>
44+
 
45+
<input type="radio" name="T-shirt_Size" id="S" value="S">
46+
<label for="S">S</label><br>
47+
 
48+
<input type="radio" name="T-shirt_Size" id="M" value="M">
49+
<label for="M">M</label><br>
50+
 
51+
<input type="radio" name="T-shirt_Size" id="L" value="L">
52+
<label for="L">L</label><br>
53+
 
54+
<input type="radio" name="T-shirt_Size" id="XL" value="XL">
55+
<label for="XL">XL</label><br>
56+
 
57+
<input type="radio" name="T-shirt_Size" id="XXL" value="XXL">
58+
<label for="XXL">XXL</label><br>
5859

59-
<style>
60-
input:invalid{background: rgb(253, 251, 253);}
61-
input:valid{background: rgb(253, 251, 253);}
62-
</style>
63-
<label>
60+
61+
62+
<label>
6463
Enter your email:
6564
<input type="email" placeholder="Enter your email" required>
66-
</p>
65+
6766
<!--The input type="email" is used so the browser can validatae the email address format-->
6867
<!--the style tag is used to style the input box. CSS pseudo-classes :valid or :invalid to check if the email is valid and notify the user-->
6968
</label>
70-
<label> <input type="submit"> <input type="resit">
69+
<label> <input type="submit">
7170
</label>
7271
</form>
7372
</main>

0 commit comments

Comments
 (0)