site/www/css-old/typing.css

75 lines
1.4 KiB
CSS
Raw Normal View History

2026-01-31 09:27:48 +10:00
html, body {
height: 100%;
margin: 0;
background-color: #0e0d14;
}
.centered {
position: absolute;
inset: 0 0 0 0;
margin: auto;
display: flex;
}
.heading {
font-family: monospace;
font-size: 2em;
font-weight: bold;
color: #ffc0cb; /* #ac4aed */
}
/* =========================================================== *
* Type Writer Effect *
/* =========================================================== */
#typing-wrapper {
margin: auto auto;
width: 39ch; /* prompt + command + cursor length */
height: 10ch;
text-align: start;
border: 0.5ch solid #ffc0cb; /* #ac4aed */
padding: 20px;
display: flex;
flex-direction: column;
justify-content: start;
align-content: center;
align-items: start;
}
#typing-prompt {
width: 38ch; /* prompt + command length */
animation: typing 3s steps(36), cursor-blink 0.6s steps(1, start) 3s infinite alternate;
white-space: nowrap;
overflow: hidden;
border-right: 1ch solid;
margin-bottom: 0.5ch;
}
#typing-result {
/* "1.8s" means the result is shown 1.8s after typing ends */
animation: unhide 1s 4.8s forwards;
visibility: hidden;
/* white-space: pre-wrap; /* preserve linebreaks */ */
}
@keyframes typing {
from {
width: 2ch /* ignore prompt width */
}
}
@keyframes cursor-blink {
50% {
border-color: transparent
}
}
@keyframes unhide {
to {
visibility: visible
}
}