Part of the Webcore kit
(1) system error
HTML
<section class="tv-webcore-dialog">
<header class="tv-webcore-dialog-bar">
<h3 class="tv-webcore-dialog-title">(1) system error</h3>
<span class="tv-webcore-dialog-close" aria-hidden="true"></span>
</header>
<div class="tv-webcore-dialog-body">
<p class="tv-webcore-dialog-message">The cat sat on the keyboard.</p>
<div class="tv-webcore-dialog-actions">
<button class="tv-webcore-dialog-button" type="button">ok</button>
<button class="tv-webcore-dialog-button" type="button">oh, no</button>
</div>
</div>
</section>
CSS
/* A retro OS alert: coloured title bar, grey face, centred message and double-ruled buttons. */
.tv-webcore-dialog {
--tv-webcore-dialog-bar: var(--tv-webcore-pink, #f7b5e4);
--tv-webcore-dialog-bar-ink: var(--tv-webcore-navy, #2c2b9f);
box-sizing: border-box;
width: 100%;
max-width: 24rem;
margin: 0 auto;
border: 2px solid var(--tv-webcore-lilac, #a49bf3);
background: var(--tv-webcore-grey, #d9d9e5);
color: var(--tv-webcore-navy, #2c2b9f);
font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
box-shadow: 4px 4px 0 color-mix(in srgb, var(--tv-webcore-navy, #2c2b9f) 25%, transparent);
}
.tv-webcore-dialog-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
min-height: 30px;
padding: 3px 4px 3px 10px;
background: var(--tv-webcore-dialog-bar, #f7b5e4);
color: var(--tv-webcore-dialog-bar-ink, #2c2b9f);
}
.tv-webcore-dialog-title {
margin: 0;
overflow: hidden;
font-size: 13px;
font-weight: 700;
letter-spacing: 0.1em;
text-overflow: ellipsis;
text-transform: uppercase;
white-space: nowrap;
}
.tv-webcore-dialog-close {
position: relative;
flex-shrink: 0;
box-sizing: border-box;
width: 22px;
height: 20px;
border: 1px solid var(--tv-webcore-navy, #2c2b9f);
background: var(--tv-webcore-paper, #ffffff);
}
.tv-webcore-dialog-close::before,
.tv-webcore-dialog-close::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 12px;
height: 2px;
background: var(--tv-webcore-navy, #2c2b9f);
transform: translate(-50%, -50%) rotate(45deg);
}
.tv-webcore-dialog-close::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
.tv-webcore-dialog-body {
padding: 24px 18px 20px;
text-align: center;
}
.tv-webcore-dialog-message {
margin: 0 0 22px;
font-size: 15px;
line-height: 1.5;
letter-spacing: 0.04em;
}
.tv-webcore-dialog-actions {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 12px;
}
/* An inner rule inside the navy edge, like the old double-lined default button. */
.tv-webcore-dialog-button {
min-width: 6.5rem;
min-height: 2.5rem;
padding: 4px 16px;
border: 1px solid var(--tv-webcore-navy, #2c2b9f);
background: var(--tv-webcore-pink, #f7b5e4);
color: var(--tv-webcore-navy, #2c2b9f);
font: inherit;
font-size: 14px;
letter-spacing: 0.06em;
cursor: pointer;
box-shadow: inset 0 0 0 3px var(--tv-webcore-pink, #f7b5e4), inset 0 0 0 4px var(--tv-webcore-navy, #2c2b9f);
}
.tv-webcore-dialog-button:hover {
background: color-mix(in srgb, var(--tv-webcore-pink, #f7b5e4) 65%, var(--tv-webcore-paper, #ffffff));
box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--tv-webcore-pink, #f7b5e4) 65%, var(--tv-webcore-paper, #ffffff)), inset 0 0 0 4px var(--tv-webcore-navy, #2c2b9f);
}
.tv-webcore-dialog-button:active {
transform: translate(1px, 1px);
}
.tv-webcore-dialog-button:focus-visible {
outline: 2px dashed var(--tv-webcore-navy, #2c2b9f);
outline-offset: 3px;
}
.tv-webcore-dialog--violet {
--tv-webcore-dialog-bar: var(--tv-webcore-violet, #a445dd);
--tv-webcore-dialog-bar-ink: var(--tv-webcore-paper, #ffffff);
}
.tv-webcore-dialog--lilac {
--tv-webcore-dialog-bar: var(--tv-webcore-lilac, #a49bf3);
--tv-webcore-dialog-bar-ink: var(--tv-webcore-navy, #2c2b9f);
}
Usage & credits
- Use when
- Playful confirmations, error and 404 pages, captcha-style gags, Y2K modals.
- Avoid when
- Serious errors or destructive confirmations where the joke gets in the way.
- Requires
- For a real modal, put it inside a native dialog element and open it with showModal(). · The close box is decorative; wire your own button if it should act.
- From
- Luna UI