{
  "format": "css.observer/playground@1",
  "id": "00000000-0000-4000-9000-000000000009",
  "url": "https://css.observer/s/floating-label-input",
  "title": "Floating label input",
  "description": "The label rides up when the field has focus or content — via :placeholder-shown, no JS.",
  "category": "forms",
  "tags": [
    "input",
    "label",
    "placeholder-shown"
  ],
  "visibility": "public",
  "status": "published",
  "revision": 1,
  "author": "observer",
  "forked_from": null,
  "created_at": "2026-12-02T04:26:36.930Z",
  "updated_at": "2026-12-02T04:26:36.930Z",
  "published_at": "2026-12-02T04:26:36.930Z",
  "source": {
    "html": "<form>\n  <div class=\"field\"><input id=\"email\" type=\"email\" placeholder=\" \" required><label for=\"email\">Email address</label></div>\n  <div class=\"field\"><input id=\"name\" placeholder=\" \"><label for=\"name\">Full name</label></div>\n</form>",
    "css": "body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: #f4f3ef; font: 16px system-ui, sans-serif; }\nform { display: grid; gap: 18px; width: 320px; }\n.field { position: relative; }\n.field input { width: 100%; box-sizing: border-box; padding: 22px 14px 8px; border: 1px solid #cfcbc2; border-radius: 12px; font: inherit; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }\n.field label { position: absolute; left: 14px; top: 15px; color: #7d7f86; pointer-events: none; transform-origin: left top; transition: transform .15s, color .15s; }\n.field input:focus { border-color: #3f6b00; box-shadow: 0 0 0 3px #e8f3d2; }\n.field input:focus + label, .field input:not(:placeholder-shown) + label { transform: translateY(-9px) scale(.75); color: #3f6b00; }\n.field input:not(:placeholder-shown):invalid { border-color: #b42318; }",
    "js": ""
  }
}