Skip to content

Commit c9d6264

Browse files
authored
Merge pull request #89 from zihanKuang/add-fixed-button
fix: Position 'go back' button on test pages to be fixed on scroll
2 parents 55b71e6 + d38e757 commit c9d6264

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

layouts/test/single.html

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,30 @@
2323
font-size: 0.95rem;
2424
}
2525

26-
.header #go-back {
27-
display: inline-block;
28-
margin-bottom: 1rem;
26+
#go-back {
27+
position: fixed;
28+
top: 160px;
29+
left: 25px;
30+
z-index: 1010;
31+
32+
width: 45px;
33+
height: 45px;
34+
background-color:white;
35+
border-radius: 50%;
36+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
37+
display: flex;
38+
justify-content: center;
39+
align-items: center;
2940
color: var(--bs-primary);
30-
font-size: 1rem;
41+
font-size: 1.1rem;
3142
cursor: pointer;
32-
transition: color 0.2s ease;
43+
transition: all 0.2s ease-in-out;
44+
border: 1px solid var(--bs-border-color);
3345
}
3446

35-
.header #go-back:hover {
47+
#go-back:hover {
48+
transform: scale(1.1);
49+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
3650
color: var(--bs-link-hover-color);
3751
}
3852

@@ -202,6 +216,14 @@
202216
}
203217

204218
@media (max-width: 768px) {
219+
#go-back {
220+
width: 38px;
221+
height: 38px;
222+
font-size: 0.9rem;
223+
top: 200px;
224+
left: 15px;
225+
}
226+
205227
.container {
206228
margin: 0;
207229
}
@@ -235,13 +257,11 @@
235257

236258
{{ $title := .Title }}
237259

238-
239260
<div class="container">
240261
<div class="header">
241-
<div id="go-back">
242-
<i class="fas fa-arrow-left"></i>
243-
<p class="text-blue-600 hover:underline" id="go-back"> Back</a>
244-
</div>
262+
<div id="go-back">
263+
<i class="fas fa-arrow-left"></i>
264+
</div>
245265
<h1>{{ $title }}</h1>
246266
<p>{{ .Content | default "Please answer the questions below to complete the test." }}</p>
247267
</div>

0 commit comments

Comments
 (0)