Skip to content

Commit 304b08c

Browse files
Style added for the forms
1 parent 778e937 commit 304b08c

2 files changed

Lines changed: 88 additions & 31 deletions

File tree

Form-Controls/index.html

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<meta name="viewport" content="width=device-width, initial-scale=1" />
1010
<style>
1111
input:valid{
12-
border:2px solid green;
12+
border:2px solid blue;
1313
}
14-
input:invalid{
14+
input:invalid:not(:placeholder-shown){
1515
border:2px solid red;
1616
}
1717
</style>
@@ -34,23 +34,33 @@ <h1>Product Pick</h1>
3434
pattern="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
3535
placeholder="Customer email" />
3636
<br />
37-
<fieldset>
38-
<legend>T-shirt Colors</legend>
39-
<input type="radio" id="black" name="colors" value="BLACK">
40-
<label for="black">BLACK</label>
41-
<input type="radio" id="bLue" name="colors" value="BLUE">
42-
<label for="blue">BLUE</label>
43-
<input type="radio" id="red" name="colors" value="RED">
44-
<label for="red">RED</label>
45-
</fieldset>
46-
<select name="size" id="sizes">
37+
<label for="t-shirtColor">T-shirt color:</label>
38+
<div class="control">
39+
40+
<label class="t-color">
41+
<input type="radio" name="color" value="Black" required/>
42+
Black
43+
</label>
44+
<label class="t-color">
45+
<input type="radio" name="color" value="Red" required/>
46+
Red
47+
</label>
48+
<label class="t-color" disabled>
49+
<input type="radio" name="color" color="Blue" required/>
50+
Blue
51+
</label>
52+
</div>
53+
<label for="sizes">T-shirt size:</label>
54+
<select name="size" id="sizes" required>
4755
<option value="xs">XS</option>
4856
<option value="s">S</option>
4957
<option value="m">M</option>
5058
<option value="l">L</option>
5159
<option value="XL">XL</option>
5260
<option vallue="XXL">XXL</optio>
5361
</select>
62+
<br />
63+
<button type="submit" id="submit">Submit</button>
5464
</form>
5565
</main>
5666
<footer>

Form-Controls/style.css

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,80 @@
1-
1+
/* body style */
22
body {
33
background-color: lightwhite;
4-
text-align:center;
54
max-width: 800px;
5+
display: flex;
6+
flex-direction: column;
7+
align-items: center;
8+
padding: 40px;
9+
}
10+
11+
header h1 {
12+
color: #2c3e50;
13+
margin-bottom: 15px;
614
}
715

8-
input {
9-
width: 150px;
10-
padding: 0;
11-
margin: 0;
12-
box-sizing: border-box;
16+
/* Form Container */
17+
form {
18+
background: #ffffff;
19+
padding: 30px;
20+
border-radius: 12px;
21+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
22+
width: 100%;
23+
max-width: 400px;
1324
}
1425

15-
fieldset {
16-
position: relative;
26+
/* Labels and Inputs */
27+
label {
28+
display: block;
29+
margin-top: 15px;
30+
margin-bottom: 5px;
31+
font-weight: 600;
32+
font-size: 0.9rem;
1733
}
1834

19-
legend {
20-
position: absolute;
21-
left: 0;
22-
top:0;
35+
input[type="text"],
36+
input[type="email"],
37+
select,button {
38+
align-items: right;
39+
width: 100%;
40+
padding: 10px;
41+
border: 2px solid #ddd;
42+
border-radius: 6px;
43+
box-sizing: border-box; /* Ensures padding doesn't break width */
44+
transition: border-color 0.3s ease;
2345
}
2446

25-
#black{
26-
background-color:black;
47+
/* Validation Styling */
48+
input:focus {
49+
outline: none;
50+
border-color: #3498db;
2751
}
28-
#red{
29-
background-color:red;
52+
53+
54+
.control {
55+
margin-top: 2px;
56+
display: flex;
57+
gap: 15px;
3058
}
31-
#blue{
32-
background-color:blue;
59+
60+
.radio {
61+
display: flex;
62+
align-items: center;
63+
gap: 5px;
64+
font-weight: normal;
65+
}
66+
#submit {
67+
background-color: #3498db;
68+
margin-top: 15px;
69+
border: none;
70+
cursor: pointer;
71+
font-size: 1rem;
72+
transition: background-color 0.3s ease;
73+
}
74+
75+
/* Footer */
76+
footer {
77+
margin-top: 20px;
78+
font-size: 0.8rem;
79+
color: #95a5a6;
3380
}

0 commit comments

Comments
 (0)