Skip to content

Commit 79173ce

Browse files
committed
Style checkboxes and radios
1 parent 333a337 commit 79173ce

1 file changed

Lines changed: 57 additions & 1 deletion

File tree

frontend/assets/styles/global.scss

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ input {
6969
font-family: var(--font-family);
7070
color: var(--input-text-color);
7171

72-
width: stretch;
7372
border-radius: 0.25rem;
7473
padding: 0.6rem;
7574
background-color: var(--input-background-color);
@@ -81,6 +80,8 @@ input {
8180
border: none;
8281
// A transparent default outline makes transitions to other outlines smoother.
8382
outline: 1px solid transparent;
83+
// Override any user agent defaults.
84+
outline-offset: 0;
8485
margin: 1px;
8586
box-shadow: $box-shadow;
8687

@@ -116,6 +117,61 @@ input {
116117
}
117118
}
118119

120+
input:not([type]),
121+
input[type="email"],
122+
input[type="password"],
123+
input[type="search"],
124+
input[type="text"],
125+
input[type="url"] {
126+
width: stretch;
127+
}
128+
129+
input[type="checkbox"],
130+
input[type="radio"] {
131+
appearance: none;
132+
133+
box-sizing: content-box;
134+
width: 1em;
135+
height: 1em;
136+
padding: 0.125em;
137+
138+
margin: 0.25em;
139+
vertical-align: middle;
140+
141+
cursor: pointer;
142+
143+
display: inline-flex;
144+
align-items: center;
145+
justify-content: center;
146+
overflow: hidden;
147+
148+
&::before {
149+
opacity: 0;
150+
transition: 0.1s ease-out opacity;
151+
}
152+
153+
&:checked::before {
154+
opacity: 1;
155+
}
156+
}
157+
158+
input[type="checkbox"]::before {
159+
content: "";
160+
}
161+
162+
input[type="radio"] {
163+
border-radius: 50%;
164+
165+
&::before {
166+
content: "";
167+
168+
background-color: currentColor;
169+
width: 50%;
170+
height: 50%;
171+
border-radius: inherit;
172+
}
173+
}
174+
119175
.warning {
120176
color: var(--warning-text-color);
121177
}

0 commit comments

Comments
 (0)