Skip to content

Commit b01c11e

Browse files
committed
refactored: refactored pattern attribute to accept hyphenated names
1 parent 64cacff commit b01c11e

2 files changed

Lines changed: 39 additions & 5 deletions

File tree

Form-Controls/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<meta name="description" content=""/>
88
<meta name="viewport" content="width=device-width, initial-scale=1"/>
99
<link rel="stylesheet" href="main.css">
10-
1110
</head>
1211
<body>
1312
<header>
@@ -16,7 +15,7 @@ <h1>Product Pick</h1>
1615
</div>
1716
</header>
1817
<main>
19-
<div class="container">
18+
<div class="container main-container">
2019
<form>
2120
<!-- write your HTML here-->
2221
<!--
@@ -36,7 +35,7 @@ <h1>Product Pick</h1>
3635
id="firstname"
3736
name="firstname"
3837
required
39-
pattern="^[A-Za-z]{2,15}$"
38+
pattern="^[A-Za-z\s'-]{2,}$"
4039
title="first name must be between 2 and 15 characters"
4140
>
4241
</div>
@@ -48,7 +47,7 @@ <h1>Product Pick</h1>
4847
id="lastname"
4948
name="lastname"
5049
required
51-
pattern="^[A-Za-z]{2,15}$"
50+
pattern="^[A-Za-z\s'-]{2,}$"
5251
title="last name must be between 2 and 15 characters">
5352
</div>
5453

@@ -71,6 +70,7 @@ <h1>Product Pick</h1>
7170
id="choice1"
7271
name="shirt"
7372
value="blue"
73+
required
7474
>
7575
<label for="choice1">Blue</label>
7676
</div>
@@ -99,7 +99,7 @@ <h1>Product Pick</h1>
9999

100100
<div class="form-group">
101101
<label for="sizing">Choose a size:</label>
102-
<select id="sizing" name="size">
102+
<select id="sizing" name="size" required>
103103
<option value="">--Please choose an option--</option>
104104
<option value="ex-small">XS</option>
105105
<option value="small">S</option>

Form-Controls/main.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
*{
2+
box-sizing: border-box;
3+
}
4+
5+
body{
6+
margin:0;
7+
padding:0;
8+
font-family: "Times New Roman", Times, serif;
9+
/*line-height:;*/
10+
background:#403d39;
11+
}
12+
header, footer{
13+
background:#ccc5b9;
14+
}
15+
/*footer{*/
16+
/* */
17+
/*}*/
18+
.main-container{
19+
background:#edede9;
20+
padding:40px 30px;
21+
}
22+
.container{
23+
/*width:;*/
24+
margin: 0 auto;
25+
}
26+
h1{
27+
font-size:2rem;
28+
text-align:center;
29+
margin-top: 0;
30+
padding:30px 0;
31+
}
32+
.form-group{
33+
margin-bottom:10px;
34+
}

0 commit comments

Comments
 (0)