Responsive profile card
A friendly introduction with a flexible layout and a clear next step.
View exampleA good first building block
A labelled text field updates a plain-text preview without submitting data.
<main><h1>A little greeting</h1><label for="name">Your display name</label><input id="name" type="text" maxlength="80" autocomplete="off" aria-describedby="hint"><p id="hint">This local demonstration sends nothing. Keep it short.</p><p id="greeting">Hello, visitor.</p><button id="clear">Clear name</button></main>:root{font-family:system-ui,sans-serif;color:#18223b}*{box-sizing:border-box}body{margin:0;min-height:100vh;padding:24px;background:#edf1ff;display:grid;place-items:center}main{width:min(100%,480px);background:white;border-radius:20px;padding:24px}h1{font-size:24px;margin:0 0 16px}button,input,select,textarea{font:inherit}button{min-height:44px;border:1px solid #afbddd;border-radius:10px;padding:10px 14px;background:#eff3ff;color:#18223b;cursor:pointer}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #3658bf;outline-offset:3px}p{line-height:1.65}label{display:block;margin:16px 0 6px}input:not([type=checkbox]),select,textarea{max-width:100%;width:100%;padding:10px;border:1px solid #afbddd;border-radius:8px}button:disabled{opacity:.5;cursor:default}const input=document.querySelector("#name"),preview=document.querySelector("#greeting");
function update(){preview.textContent="Hello, "+(input.value.trim()||"visitor")+".";}
input.addEventListener("input",update);document.querySelector("#clear").addEventListener("click",()=>{input.value="";update();input.focus();});<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My code example</title>
<style>
:root{font-family:system-ui,sans-serif;color:#18223b}*{box-sizing:border-box}body{margin:0;min-height:100vh;padding:24px;background:#edf1ff;display:grid;place-items:center}main{width:min(100%,480px);background:white;border-radius:20px;padding:24px}h1{font-size:24px;margin:0 0 16px}button,input,select,textarea{font:inherit}button{min-height:44px;border:1px solid #afbddd;border-radius:10px;padding:10px 14px;background:#eff3ff;color:#18223b;cursor:pointer}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #3658bf;outline-offset:3px}p{line-height:1.65}label{display:block;margin:16px 0 6px}input:not([type=checkbox]),select,textarea{max-width:100%;width:100%;padding:10px;border:1px solid #afbddd;border-radius:8px}button:disabled{opacity:.5;cursor:default}
</style>
</head>
<body>
<main><h1>A little greeting</h1><label for="name">Your display name</label><input id="name" type="text" maxlength="80" autocomplete="off" aria-describedby="hint"><p id="hint">This local demonstration sends nothing. Keep it short.</p><p id="greeting">Hello, visitor.</p><button id="clear">Clear name</button></main>
<script>
const input=document.querySelector("#name"),preview=document.querySelector("#greeting");
function update(){preview.textContent="Hello, "+(input.value.trim()||"visitor")+".";}
input.addEventListener("input",update);document.querySelector("#clear").addEventListener("click",()=>{input.value="";update();input.focus();});
</script>
</body>
</html>example.html.A real label identifies the field. The preview uses textContent, so angle brackets are displayed as text. The maxlength attribute counts UTF-16 code units. This example has no submit or storage; a production form needs its own purpose, validation and data handling.
Historical purpose: The stage-one 2014 archive recovery verified this exact detail purpose. This is an original modern implementation; no archived third-party code, credit link, remote script or guessed numeric preview mapping is reused.
The greeting is assigned with textContent, so angle brackets remain literal text. Keep the input label, id and greeting target together. The value is local and is not sent or saved; a real profile form needs a backend and server validation.
This is newly authored code. It uses system fonts and no external assets.
Keep the ideas going