Skip to content

Commit 7752872

Browse files
committed
Add form styling file and enhance accessibility with aria attributes
1 parent e852363 commit 7752872

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

Form-Controls/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<title>My form exercise</title>
88
<meta name="description" content="form exercise demonstrating accessible form controls." />
99
<meta name="viewport" content="width=device-width, initial-scale=1" />
10+
<link rel="stylesheet" href="style.css" />
1011
</head>
1112

1213
<body>
@@ -17,17 +18,17 @@ <h1>My Store T-shirt Sales</h1>
1718
<form>
1819
<div>
1920
<label for="name">Name</label>
20-
<input type="text" name="name" id="name" placeholder="Username" required>
21+
<input type="text" name="name" id="name" placeholder="Username" required aria-required="true">
2122
</div>
2223

2324
<div>
2425
<label for="email">Email</label>
25-
<input type="email" name="email" id="email" placeholder="Name@example.com" required>
26+
<input type="email" name="email" id="email" placeholder="Name@example.com" required aria-required="true">
2627
</div>
2728

2829
<div>
2930
<label for="color">Color</label>
30-
<select name="color" id="color" required>
31+
<select name="color" id="color" required aria-required="true">
3132
<option value="" disabled selected>-- select a color --</option>
3233
<option value="Black">Black</option>
3334
<option value="Blue">Blue</option>
@@ -37,7 +38,7 @@ <h1>My Store T-shirt Sales</h1>
3738

3839
<div>
3940
<label for="size">Size</label>
40-
<select name="size" id="size" required>
41+
<select name="size" id="size" required aria-required="true">
4142
<option value="" disabled selected> -- select a size --</option>
4243
<option value="XS">XS</option>
4344
<option value="S">S</option>

Form-Controls/style.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
body {
2+
color: #000;
3+
background: #fff;
4+
font-size: 16px;
5+
line-height: 1.5;
6+
}
7+
8+
label {
9+
display: block;
10+
margin-bottom: 8px;
11+
font-weight: bold;
12+
}
13+
14+
input,
15+
select,
16+
button {
17+
font-size: 16px;
18+
padding: 10px;
19+
}
20+
21+
input:focus,
22+
select:focus,
23+
button:focus {
24+
outline: 3px solid #4a90e2;
25+
outline-offset: 2px;
26+
}
27+
28+
button {
29+
background-color: #0066cc;
30+
color: #fff;
31+
border: none;
32+
cursor: pointer;
33+
}

0 commit comments

Comments
 (0)