Avatar profile stamp in HTML, CSS and vanilla JS
A copy-paste Avatar profile stamp in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<div class="dcl-avatar-profile-stamp" data-dcl-scheme="light">
<figure class="dcl-avatar-profile-stamp-stamp"><span class="dcl-avatar-profile-stamp-face dcl-avatar-profile-stamp-accent" aria-hidden="true">RP</span><figcaption><h3>Rowan Price</h3><p class="dcl-avatar-profile-stamp-muted">Ceramics tutor · North workshop</p></figcaption></figure>
<script>
(() => {
const root = document.currentScript.closest(".dcl-avatar-profile-stamp");
const preference = matchMedia("(prefers-color-scheme: dark)");
function setScheme() { root.dataset.dclScheme = preference.matches ? "dark" : "light"; }
preference.addEventListener("change", setScheme);
setScheme();
})();
</script>
</div>
<style>
.dcl-avatar-profile-stamp, .dcl-avatar-profile-stamp * { box-sizing: border-box; }
.dcl-avatar-profile-stamp { max-inline-size: 44rem; margin-inline: auto; padding: clamp(.875rem, 4vw, 1.5rem); border: 1px solid; border-radius: .75rem; font: 1rem/1.5 system-ui, sans-serif; overflow-wrap: anywhere; }
.dcl-avatar-profile-stamp h3, .dcl-avatar-profile-stamp h4, .dcl-avatar-profile-stamp p, .dcl-avatar-profile-stamp figure, .dcl-avatar-profile-stamp dl, .dcl-avatar-profile-stamp ul, .dcl-avatar-profile-stamp ol { margin: 0; }
.dcl-avatar-profile-stamp h3 { font-size: 1.18rem; line-height: 1.25; }
.dcl-avatar-profile-stamp header { margin-block-end: .875rem; }
.dcl-avatar-profile-stamp .dcl-avatar-profile-stamp-eyebrow { font-size: .8125rem; font-weight: 700; letter-spacing: .06em; }
.dcl-avatar-profile-stamp .dcl-avatar-profile-stamp-well { padding: .7rem .8rem; border: 1px solid; border-radius: .55rem; }
.dcl-avatar-profile-stamp .dcl-avatar-profile-stamp-muted { font-size: .875rem; }
.dcl-avatar-profile-stamp .dcl-avatar-profile-stamp-row { display: flex; gap: .55rem .8rem; align-items: center; flex-wrap: wrap; }
.dcl-avatar-profile-stamp .dcl-avatar-profile-stamp-grid { display: grid; gap: .65rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.dcl-avatar-profile-stamp dt { font-size: .875rem; font-weight: 650; }
.dcl-avatar-profile-stamp dd { margin: 0; }
.dcl-avatar-profile-stamp .dcl-avatar-profile-stamp-value { font-size: clamp(1.35rem, 5vw, 1.9rem); font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dcl-avatar-profile-stamp button, .dcl-avatar-profile-stamp summary, .dcl-avatar-profile-stamp input { font: inherit; }
.dcl-avatar-profile-stamp button, .dcl-avatar-profile-stamp summary { min-height: 2.75rem; cursor: pointer; }
.dcl-avatar-profile-stamp button { padding: .35rem .7rem; border: 1px solid; border-radius: .4rem; }
.dcl-avatar-profile-stamp button:active { transform: translateY(1px); }
.dcl-avatar-profile-stamp button:disabled { cursor: default; border-style: dashed; }
.dcl-avatar-profile-stamp [hidden] { display: none; }
.dcl-avatar-profile-stamp-face { inline-size: 2.9rem; block-size: 2.9rem; border-radius: 50%; flex: none; display: inline-grid; place-items: center; font-weight: 750; }
.dcl-avatar-profile-stamp-stamp { text-align:center; display:grid; justify-items:center; gap:.65rem; }
.dcl-avatar-profile-stamp-stamp .dcl-avatar-profile-stamp-face { inline-size:4.4rem; block-size:4.4rem; font-size:1.35rem; border-radius:1rem; }
.dcl-avatar-profile-stamp[data-dcl-scheme="light"] { color: #11292f; background-color: #ffffff; border-color: #697f84; color-scheme: light; }
.dcl-avatar-profile-stamp[data-dcl-scheme="light"] .dcl-avatar-profile-stamp-muted, .dcl-avatar-profile-stamp[data-dcl-scheme="light"] .dcl-avatar-profile-stamp-eyebrow { color: #405a60; }
.dcl-avatar-profile-stamp[data-dcl-scheme="light"] .dcl-avatar-profile-stamp-well, .dcl-avatar-profile-stamp[data-dcl-scheme="light"] button, .dcl-avatar-profile-stamp[data-dcl-scheme="light"] kbd { color: #11292f; background-color: #e4edef; border-color: #697f84; }
.dcl-avatar-profile-stamp[data-dcl-scheme="light"] .dcl-avatar-profile-stamp-accent, .dcl-avatar-profile-stamp[data-dcl-scheme="light"] button:hover { color: #ffffff; background-color: #00535a; border-color: #00535a; }
.dcl-avatar-profile-stamp[data-dcl-scheme="light"] :focus-visible { outline: 3px solid #005c62; outline-offset: 2px; }
.dcl-avatar-profile-stamp[data-dcl-scheme="light"] meter, .dcl-avatar-profile-stamp[data-dcl-scheme="light"] progress, .dcl-avatar-profile-stamp[data-dcl-scheme="light"] input { accent-color: #00535a; }
.dcl-avatar-profile-stamp[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; border-color: #839fa5; color-scheme: dark; }
.dcl-avatar-profile-stamp[data-dcl-scheme="dark"] .dcl-avatar-profile-stamp-muted, .dcl-avatar-profile-stamp[data-dcl-scheme="dark"] .dcl-avatar-profile-stamp-eyebrow { color: #b0c9ce; }
.dcl-avatar-profile-stamp[data-dcl-scheme="dark"] .dcl-avatar-profile-stamp-well, .dcl-avatar-profile-stamp[data-dcl-scheme="dark"] button, .dcl-avatar-profile-stamp[data-dcl-scheme="dark"] kbd { color: #eff8f9; background-color: #1c3c44; border-color: #839fa5; }
.dcl-avatar-profile-stamp[data-dcl-scheme="dark"] .dcl-avatar-profile-stamp-accent, .dcl-avatar-profile-stamp[data-dcl-scheme="dark"] button:hover { color: #11292f; background-color: #8fe1da; border-color: #8fe1da; }
.dcl-avatar-profile-stamp[data-dcl-scheme="dark"] :focus-visible { outline: 3px solid #8fe1da; outline-offset: 2px; }
.dcl-avatar-profile-stamp[data-dcl-scheme="dark"] meter, .dcl-avatar-profile-stamp[data-dcl-scheme="dark"] progress, .dcl-avatar-profile-stamp[data-dcl-scheme="dark"] input { accent-color: #8fe1da; }
</style>
When to use
Use in a narrow instructor profile where identity is the main content. Set the initials, name and short affiliation together.
Avoid
Do not use this standalone treatment in a long dense member list.
Accessibility
The figure caption names the person instead of repeating the decorative initials. Main text contrast is 15.2:1 in light and 13.1:1 in dark.
Was this useful? Send feedback.