dobutterfliescry.net/www/typing.css

71 lines
1.3 KiB
CSS

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 */
text-align: start;
border: 0.5ch solid #ffc0cb; /* #ac4aed */
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
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;
}
#typing-result {
/* "3.8s" means the result is shown 0.8s after typing ends */
animation: unhide 1s 3.8s forwards;
visibility: hidden;
}
@keyframes typing {
from {
width: 2ch /* ignore prompt width */
}
}
@keyframes cursor-blink {
50% {
border-color: transparent
}
}
@keyframes unhide {
to {
visibility: visible
}
}