Skip to content

Commit 2cfa7e1

Browse files
committed
Tidied up hello text - fixed wrapping, shifting on hover, etc.
1 parent c9a1e1a commit 2cfa7e1

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
<img src="LOGO-DIGITALCIRCLE.png" alt="The Digital Circle">
2828
<div class="block">
2929
<h1>
30-
We love <a href="" class="typewrite" data-period="2000" data-type='[ "permaculture. ", "open source. " ]'>
31-
<span class="wrap"></span>
32-
</a>
30+
We love <span class="typewrite" data-period="2000" data-type='[ "permaculture. ", "open source. " ]' aria-live="polite">
31+
<span class="wrap" aria-hidden="true"></span>
32+
</span>
3333
</h1>
3434
</div>
3535
</div>

style.css

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ html {
55
font-style: normal;
66
color: #222;
77
font-size: 16px;
8-
font-size: clamp(18px, 3.0vw, 40px);
8+
font-size: clamp(18px, 2.2vw, 40px);
99
}
1010

1111
*, *::before, *::after {
@@ -237,6 +237,30 @@ p a:hover {
237237
animation: cursor 1s ease-in-out infinite;
238238
font-weight: bold;
239239
}
240+
241+
/* Prevent the typewriter/typewrite text from wrapping unexpectedly */
242+
.typewrite {
243+
display: inline-block;
244+
white-space: nowrap;
245+
}
246+
.typewrite > .wrap {
247+
white-space: pre; /* preserve intentional spaces */
248+
}
249+
/* Keep the hello heading (and its typewrite content) on one line when space allows */
250+
/* keep the hello heading on one line when there's room; use flex to avoid inline wrapping glitches */
251+
.section.section--hello .block h1 {
252+
display: inline-flex;
253+
flex-wrap: nowrap;
254+
align-items: center;
255+
gap: 0.5rem;
256+
white-space: nowrap;
257+
}
258+
@media (max-width: 520px) {
259+
.section.section--hello .block h1 {
260+
display: block;
261+
white-space: normal; /* allow wrapping on small screens */
262+
}
263+
}
240264
@keyframes cursor {
241265
from { border-color: #ffe509; }
242266
to { border-color: transparent; }

0 commit comments

Comments
 (0)