Skip to content

Commit 89c1da6

Browse files
D'SouzaD'Souza
authored andcommitted
Add subtle hover effect to summary stats
1 parent 9798d0c commit 89c1da6

1 file changed

Lines changed: 49 additions & 1 deletion

File tree

docs/css/styles.css

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,57 @@ a {
130130
display: grid;
131131
grid-template-columns: repeat(4, minmax(0, 1fr));
132132
gap: 1px;
133-
overflow: hidden;
134133
margin: 34px 0 18px;
135134
border: 1px solid var(--line);
136135
border-radius: 4px;
137136
background: var(--line);
137+
box-shadow: 0 12px 28px rgba(36, 36, 36, 0.04);
138138
}
139139

140140
.facts div {
141+
position: relative;
141142
padding: 17px 14px;
142143
background: #fff;
143144
text-align: center;
145+
transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
146+
}
147+
148+
.facts div::before {
149+
position: absolute;
150+
top: 0;
151+
right: 0;
152+
left: 0;
153+
height: 3px;
154+
background: var(--accent);
155+
content: "";
156+
opacity: 0;
157+
transition: opacity 160ms ease;
158+
}
159+
160+
.facts div:hover,
161+
.facts div:focus-within {
162+
z-index: 1;
163+
background: #fbfefe;
164+
box-shadow: 0 14px 28px rgba(8, 127, 131, 0.12);
165+
transform: translateY(-3px) scale(1.015);
166+
}
167+
168+
.facts div:hover::before,
169+
.facts div:focus-within::before {
170+
opacity: 1;
144171
}
145172

146173
.facts strong {
147174
display: block;
148175
color: var(--accent);
149176
font-size: 1.6rem;
150177
line-height: 1.05;
178+
transition: transform 160ms ease;
179+
}
180+
181+
.facts div:hover strong,
182+
.facts div:focus-within strong {
183+
transform: scale(1.06);
151184
}
152185

153186
.facts span {
@@ -436,3 +469,18 @@ pre {
436469
text-align: left;
437470
}
438471
}
472+
473+
@media (prefers-reduced-motion: reduce) {
474+
.facts div,
475+
.facts div::before,
476+
.facts strong {
477+
transition: none;
478+
}
479+
480+
.facts div:hover,
481+
.facts div:focus-within,
482+
.facts div:hover strong,
483+
.facts div:focus-within strong {
484+
transform: none;
485+
}
486+
}

0 commit comments

Comments
 (0)