{
  "format": "css.observer/playground@1",
  "id": "00000000-0000-4000-9000-000000000009",
  "url": "https://css.observer/s/floating-label-input",
  "title": "Floating label input",
  "description": "Text fields whose label moves above the value once you type, using :placeholder-shown instead of JavaScript.",
  "category": "forms",
  "tags": [
    "input",
    "label",
    "placeholder-shown"
  ],
  "visibility": "public",
  "status": "published",
  "revision": 1,
  "author": "observer",
  "forked_from": null,
  "created_at": "2026-12-02T05:10:01.946Z",
  "updated_at": "2026-12-02T05:10:01.946Z",
  "published_at": "2026-12-02T05:10:01.946Z",
  "source": {
    "html": "<form class=\"form\">\n  <div class=\"field\">\n    <input id=\"email\" type=\"email\" placeholder=\" \" required>\n    <label for=\"email\">Email address</label>\n  </div>\n  <div class=\"field\">\n    <input id=\"name\" type=\"text\" placeholder=\" \">\n    <label for=\"name\">Full name</label>\n  </div>\n</form>",
    "css": "body {\n  margin: 0;\n  min-height: 100vh;\n  display: grid;\n  place-items: center;\n  background: #f4f3ef;\n  font: 16px/1.4 system-ui, sans-serif;\n}\n\n.form {\n  display: grid;\n  gap: 18px;\n  width: 320px;\n}\n\n.field {\n  position: relative;\n}\n\n.field input {\n  box-sizing: border-box;\n  width: 100%;\n  padding: 22px 14px 8px;\n  border: 1px solid #cfcbc2;\n  border-radius: 12px;\n  background: #fff;\n  font: inherit;\n  outline: none;\n  transition: border-color 0.15s, box-shadow 0.15s;\n}\n\n.field label {\n  position: absolute;\n  top: 15px;\n  left: 14px;\n  color: #6b6d73;\n  pointer-events: none;\n  transform-origin: left top;\n  transition: transform 0.15s, color 0.15s;\n}\n\n.field input:focus {\n  border-color: #111;\n  box-shadow: 0 0 0 3px #e5e3dd;\n}\n\n.field input:focus + label,\n.field input:not(:placeholder-shown) + label {\n  transform: translateY(-9px) scale(0.75);\n  color: #111;\n}\n\n.field input:not(:placeholder-shown):invalid {\n  border-color: #b42318;\n}",
    "js": ""
  }
}