Skip to content

Commit 6dc9a8d

Browse files
committed
Accessibility
1 parent c12a603 commit 6dc9a8d

1 file changed

Lines changed: 63 additions & 43 deletions

File tree

Form-Controls/style.css

Lines changed: 63 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,119 @@
1-
/* Reset some default styles */
1+
/* RESET */
22
* {
33
box-sizing: border-box;
44
margin: 0;
55
padding: 0;
66
font-family: Arial, Helvetica, sans-serif;
77
}
88

9-
/* Page layout */
9+
/* PAGE */
1010
body {
1111
background-color: #f7f7f7;
12-
color: #333;
12+
color: #333; /* high contrast for accessibility */
1313
line-height: 1.5;
1414
padding: 20px;
1515
}
1616

17-
/* Center content */
18-
main {
19-
max-width: 500px;
20-
margin: 40px auto;
21-
background: #ffffff;
22-
padding: 25px;
23-
border-radius: 8px;
24-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
25-
}
26-
27-
/* Header */
17+
/* HEADER */
2818
header h1 {
2919
text-align: center;
30-
margin-bottom: 20px;
3120
font-weight: 500;
21+
margin-bottom: 20px;
3222
}
3323

34-
/* Form spacing */
24+
/* MAIN CONTAINER */
25+
main {
26+
max-width: 520px;
27+
margin: 40px auto;
28+
background: #fff;
29+
padding: 25px;
30+
border-radius: 10px;
31+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
32+
}
33+
34+
/* FORM ELEMENT SPACING */
3535
form div,
3636
fieldset {
37-
margin-bottom: 15px;
37+
margin-bottom: 16px;
3838
}
3939

40-
/* Labels */
40+
/* LABELS */
4141
label {
4242
display: block;
43-
margin-bottom: 5px;
44-
font-size: 0.9rem;
43+
margin-bottom: 6px;
44+
font-size: 0.95rem;
45+
color: #333;
4546
}
4647

47-
/* Inputs and select */
48+
/* INPUT + SELECT */
4849
input,
4950
select {
5051
width: 100%;
51-
padding: 8px 10px;
52-
border: 1px solid #ccc;
53-
border-radius: 5px;
54-
font-size: 0.95rem;
52+
padding: 10px;
53+
border: 1px solid #bbb;
54+
border-radius: 6px;
55+
font-size: 1rem;
56+
background: #fff;
57+
color: #333;
5558
}
5659

57-
/* Radio buttons inline */
60+
/* FOCUS STATES (IMPORTANT FOR ACCESSIBILITY SCORE 100) */
61+
input:focus,
62+
select:focus {
63+
outline: 3px solid #000;
64+
outline-offset: 2px;
65+
}
66+
67+
/* FIELDSET */
68+
fieldset {
69+
border: 1px solid #ddd;
70+
border-radius: 6px;
71+
padding: 10px;
72+
}
73+
74+
/* LEGEND */
75+
legend {
76+
padding: 0 6px;
77+
font-weight: 500;
78+
}
79+
80+
/* RADIO OPTIONS */
5881
fieldset label {
5982
display: inline-flex;
6083
align-items: center;
6184
margin-right: 15px;
62-
font-size: 0.9rem;
85+
font-size: 0.95rem;
86+
cursor: pointer;
6387
}
6488

6589
fieldset input {
66-
margin-right: 5px;
90+
margin-right: 6px;
6791
}
6892

69-
/* Fieldset styling */
70-
fieldset {
71-
border: 1px solid #ddd;
72-
padding: 10px;
73-
border-radius: 5px;
74-
}
75-
76-
/* Button */
93+
/* BUTTON */
7794
button {
7895
width: 100%;
79-
padding: 10px;
96+
padding: 12px;
8097
border: none;
98+
border-radius: 6px;
8199
background-color: #333;
82100
color: #fff;
83101
font-size: 1rem;
84-
border-radius: 5px;
85102
cursor: pointer;
86103
}
87104

88-
/* Button hover */
89-
button:hover {
105+
/* BUTTON HOVER + FOCUS */
106+
button:hover,
107+
button:focus {
90108
background-color: #555;
109+
outline: 3px solid #000;
110+
outline-offset: 2px;
91111
}
92112

93-
/* Footer */
113+
/* FOOTER */
94114
footer {
95115
text-align: center;
96116
margin-top: 20px;
97-
font-size: 0.8rem;
98-
color: #777;
117+
font-size: 0.85rem;
118+
color: #444; /* improved contrast */
99119
}

0 commit comments

Comments
 (0)