HTML
CSS
Result
Skip Results Iframe
EDIT ON
Live
Live
This Pen is owned by
web.dev
on
CodePen
.
See more by @web-dot-dev on CodePen
External CSS
https://codepen.io/web-dot-dev/pen/XWqWYgB.css
https://codepen.io/web-dot-dev/pen/ZExZWBQ.css
External JavaScript
https://codepen.io/web-dot-dev/pen/XWqWYgB.js
https://codepen.io/web-dot-dev/pen/ZExZWBQ.js
{"__browser":{"country":"US","device":"unknown_device","mobile":false,"name":"unknown browser","platform":"unknown_platform","version":"0"},"__constants":{},"__CPDATA":{"domain_iframe":"https://cdpn.io","environment":"production","host":"codepen.io","iframe_allow":"accelerometer *; ambient-light-sensor *; camera *; display-capture *; encrypted-media *; geolocation *; gyroscope *; microphone *; midi *; payment *; vr *; web-share *; serial *; xr-spatial-tracking *","iframe_sandbox":"allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups-to-escape-sandbox allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation"},"__graphql":{"data":{"errors":[{"message":"Cannot return null for non-nullable field Query.sessionUser"}],"data":null},"url":"https://codepen.io/graphql","api":"cprails"},"__pay_stripe_public_key":"pk_live_2GndomDfiklqpSNQn8FrGuwZSMIMzha7DkLJqlYe7IR0ihKAlKdiHg68JJc5eVPt68rzAjzAAVXcUwjySHRCsgjQQ00gtRBUFNH","__pay_braintree_env":"production","__boomboom":{"serve_url":"https://cdpn.io/cpe/boomboom","store_url":"https://codepen.io/cpe/boomboom/store"},"__pageType":"embed","__item":"{\"editor_settings\":{\"auto_run\":true,\"autocomplete\":false,\"code_folding\":true,\"css_pre_processor\":\"none\",\"css_prefix\":\"neither\",\"css_starter\":\"neither\",\"emmet_active\":true,\"font_size\":14,\"font_type\":\"system\",\"format_on_save\":true,\"html_pre_processor\":\"none\",\"indent_with\":\"spaces\",\"js_pre_processor\":\"none\",\"key_bindings\":\"normal\",\"line_numbers\":true,\"line_wrapping\":true,\"match_brackets\":true,\"snippets\":{\"markupSnippets\":{},\"stylesheetSnippets\":{}},\"tab_size\":2,\"theme\":\"twilight\",\"id\":\"qBMaOeL\",\"auto_save\":true},\"hashid\":\"qBMaOeL\",\"itemType\":\"pen\",\"resources\":[{\"url\":\"https://codepen.io/web-dot-dev/pen/XWqWYgB.css\",\"order\":0,\"resource_type\":\"css\",\"par_content\":\"\"},{\"url\":\"https://codepen.io/web-dot-dev/pen/XWqWYgB.js\",\"order\":0,\"resource_type\":\"js\",\"par_content\":\"\"},{\"url\":\"https://codepen.io/web-dot-dev/pen/ZExZWBQ.css\",\"order\":1,\"resource_type\":\"css\",\"par_content\":\"\"},{\"url\":\"https://codepen.io/web-dot-dev/pen/ZExZWBQ.js\",\"order\":1,\"resource_type\":\"js\",\"par_content\":\"\"}],\"tags\":[],\"id\":66704510,\"user_id\":5928893,\"html\":\"<form onsubmit=\\\"e => preventDefault()\\\">\\n <div class=\\\"form-groups\\\">\\n <div class=\\\"form-group\\\">\\n <label for=\\\"name\\\" class=\\\"form-group__label\\\">\\n Name\\n </label>\\n <input required=\\\"\\\" type=\\\"text\\\" id=\\\"name\\\" class=\\\"form-input\\\" placeholder=\\\"Name\\\" title=\\\"Name must be at least 2 characters\\\" pattern=\\\".{2,}\\\" />\\n </div>\\n <div class=\\\"form-group\\\">\\n <label for=\\\"email\\\" class=\\\"form-group__label\\\">\\n Email\\n </label>\\n <input required type=\\\"email\\\" id=\\\"email\\\" class=\\\"form-input\\\" title=\\\"Enter valid email address\\\" placeholder=\\\"Email\\\" />\\n </div>\\n <div class=\\\"form-group\\\">\\n <label for=\\\"password\\\" class=\\\"form-group__label\\\">\\n Password\\n </label>\\n <input required=\\\"\\\" type=\\\"password\\\" id=\\\"password\\\" class=\\\"form-input\\\" placeholder=\\\"Password\\\" title=\\\"Password must be at least 8 characters\\\" pattern=\\\".{8,}\\\" />\\n </div>\\n </div>\\n <div class=\\\"form-actions\\\">\\n <label>Layout</label>\\n <div class=\\\"radio-groups\\\">\\n <input type=\\\"radio\\\" name=orientation checked id=vertical />\\n <label for=vertical>Vertical</label>\\n <input type=\\\"radio\\\" name=orientation id=stagger />\\n <label for=stagger>Staggered</label>\\n <input type=\\\"radio\\\" name=orientation id=horizontal />\\n <label for=horizontal>Horizontal</label>\\n </div>\\n </div>\\n <div class=\\\"form-actions\\\">\\n <label></label>\\n <button type=\\\"submit\\\">Sign up</button>\\n </div>\\n\\n</form>\\n<div class=\\\"form-indicator\\\">👈</div>\",\"css\":\"@layer demo {\\n :root:has(#vertical:checked) {\\n --flow: row;\\n }\\n\\n :root:has(#horizontal:checked) {\\n --flow: column;\\n --twist: 1;\\n }\\n\\n :root:has(#stagger:checked) {\\n --stagger: 1;\\n }\\n :root {\\n --active-anchor: --name;\\n --active-left: anchor(var(--active-anchor) right);\\n --active-top: calc(\\n anchor(var(--active-anchor) top) +\\n (\\n (\\n anchor(var(--active-anchor) bottom) -\\n anchor(var(--active-anchor) top)\\n ) * 0.5\\n )\\n );\\n }\\n\\n :root:has(.form-group:focus-within) {\\n --anchor-scale: 1;\\n --anchor-transition: top 0.2s, left 0.2s, transform 0.2s;\\n }\\n\\n #email {\\n anchor-name: --email;\\n }\\n #name {\\n anchor-name: --name;\\n }\\n #password {\\n anchor-name: --password;\\n }\\n\\n :root:has(#email:focus) {\\n --active-anchor: --email;\\n }\\n :root:has(#name:focus) {\\n --active-anchor: --name;\\n }\\n :root:has(#password:focus) {\\n --active-anchor: --password;\\n }\\n\\n .form-indicator {\\n left: var(--active-left);\\n top: var(--active-top);\\n transform: translate(\\n var(--active-translate-x, 1rem),\\n var(--active-translate-y, -50%)\\n )\\n scale(var(--anchor-scale, 0)) rotate(calc(var(--twist, 0) * -90deg));\\n transition: var(\\n --anchor-transition,\\n top 0.2s 0.2s,\\n left 0.2s 0.2s,\\n transform 0.2s\\n );\\n font-size: 4rem;\\n background: none;\\n position: fixed;\\n }\\n\\n :root:has(#horizontal:checked) {\\n --active-translate-x: -50%;\\n --active-translate-y: -150%;\\n --active-left: calc(\\n anchor(var(--active-anchor) left) +\\n (\\n (\\n anchor(var(--active-anchor) right) -\\n anchor(var(--active-anchor) left)\\n ) * 0.5\\n )\\n );\\n --active-top: calc(\\n anchor(var(--active-anchor) top) +\\n (\\n (\\n anchor(var(--active-anchor) bottom) -\\n anchor(var(--active-anchor) top)\\n ) * 0.5\\n )\\n );\\n }\\n}\\n\\n* {\\n box-sizing: border-box;\\n}\\n\\n:root {\\n --red: hsl(18 100% 50%);\\n --green: hsl(130 52% 46%);\\n --yellow: hsl(44 83% 53%);\\n --blue: hsl(215 100% 53%);\\n --grey: hsl(0 0% 45%);\\n --text: var(--gray-5);\\n --transition: 0.2s;\\n --valid: var(--green);\\n --invalid: var(--red);\\n --focus: var(--yellow);\\n --blur: var(--gray-0);\\n --disabled: var(--grey);\\n}\\n\\n.whitespace {\\n width: 0.5ch;\\n}\\n\\n:where(html) {\\n background-color: transparent;\\n color-scheme: none;\\n}\\n\\nbody {\\n display: grid;\\n min-height: 100vh;\\n place-items: center;\\n overflow: hidden;\\n margin: 0;\\n background-color: var(--gray-9);\\n font-size: 1rem;\\n}\\n\\nform {\\n display: grid;\\n grid-gap: 1rem;\\n place-items: center;\\n}\\n\\n.form-groups {\\n display: grid;\\n grid-gap: 1rem;\\n grid-auto-flow: var(--flow);\\n}\\n\\n.form-actions {\\n width: 100%;\\n}\\n\\n.radio-groups {\\n display: grid;\\n grid-template-columns: auto 1fr;\\n align-items: center;\\n justify-content: center;\\n gap: 0.5rem;\\n}\\n\\n.radio-groups label {\\n font-weight: 300;\\n font-size: 1rem;\\n}\\n\\n.radio-groups * {\\n display: inline-block;\\n}\\n\\n.form-group,\\n.form-actions {\\n --color: var(--blur);\\n display: grid;\\n grid-auto-flow: column;\\n align-items: center;\\n justify-content: flex-end;\\n}\\n\\n.form-group {\\n position: relative;\\n left: calc((var(--stagger, 0) * var(--index)) * 4rem);\\n}\\n\\n.form-group:nth-of-type(1) {\\n --index: 0;\\n}\\n\\n.form-group:nth-of-type(2) {\\n --index: 1;\\n}\\n\\n.form-group:nth-of-type(3) {\\n --index: 2;\\n}\\n\\nlabel {\\n font-family: sans-serif;\\n display: flex;\\n font-weight: bold;\\n padding-right: 1rem;\\n transform-style: preserve-3d;\\n transition: color var(--transition);\\n color: var(--color);\\n font-size: 1.25rem;\\n}\\n\\n.form-group label {\\n grid-row: 1;\\n}\\ninput:not([type=\\\"radio\\\"]) {\\n grid-row: 1;\\n border: 4px solid var(--blur);\\n background: var(--blur);\\n border-radius: 4px;\\n padding: 1rem 2rem;\\n font-weight: 400;\\n transition: border-color var(--transition);\\n outline: transparent;\\n}\\n\\ninput:focus-visible {\\n outline-color: var(--color);\\n}\\n\\ninput::placeholder {\\n color: transparent;\\n}\\n\\nbutton {\\n padding: 1rem 2rem;\\n border-radius: 4px;\\n border: 0;\\n cursor: pointer;\\n background: var(--disabled);\\n font-weight: bold;\\n font-size: 1.25rem;\\n color: var(--gray-5);\\n transition: color var(--transition), background var(--transition);\\n}\\n\\ninput:not([type=\\\"radio\\\"]),\\nbutton,\\n.radio-groups {\\n width: 250px;\\n}\\n\\n.form-group:has(:invalid) {\\n --color: var(--invalid);\\n}\\n\\n.form-group:has(:focus) {\\n --color: var(--focus);\\n}\\n\\n.form-group:has(:valid) {\\n --color: var(--valid);\\n}\\n\\n@media (prefers-reduced-motion: no-preference) {\\n .form-group:has(:valid) label span {\\n display: inline-block;\\n animation: jump 0.25s calc(var(--char-index) * 0.05s);\\n }\\n @keyframes jump {\\n 50% {\\n transform: translateY(-50%);\\n }\\n }\\n .form-group:has(:invalid:not(:focus):not(:placeholder-shown)) {\\n animation: shake 0.2s;\\n }\\n @keyframes shake {\\n 0%,\\n 100% {\\n transform: translateX(0);\\n }\\n 20%,\\n 40%,\\n 60%,\\n 80% {\\n transform: translateX(-2%);\\n }\\n 10%,\\n 30%,\\n 50%,\\n 70%,\\n 90% {\\n transform: translateX(2%);\\n }\\n }\\n}\\n\\n.form-group:has(:placeholder-shown:not(:focus)) label span {\\n animation: none;\\n}\\n\\n.form-group:has(:placeholder-shown) {\\n --color: var(--blur);\\n}\\n\\n.form-group:has(:invalid:not(:focus):not(:placeholder-shown))\\n .form-group__error {\\n display: block;\\n}\\n\\n.form-group__input {\\n position: relative;\\n}\\n\\n.form-group__error {\\n display: none;\\n white-space: nowrap;\\n color: var(--red);\\n font-size: var(--font-size-0);\\n grid-row: 2;\\n grid-column: 2;\\n padding: var(--size-2);\\n text-align: center;\\n}\\n\\nlabel span {\\n display: inline-block;\\n}\\n\\n.sr-only {\\n position: absolute;\\n width: 1px;\\n height: 1px;\\n padding: 0;\\n margin: -1px;\\n overflow: hidden;\\n clip: rect(0, 0, 0, 0);\\n white-space: nowrap;\\n border-width: 0;\\n}\\n\\n/*.form-group:has(:valid) ~ .form-group:has(:valid) ~ [type=\\\"submit\\\"] {\\n background: var(--valid);\\n color: var(--gray-1);\\n}*/\\n\\nform:valid [type=\\\"submit\\\"] {\\n background: var(--valid);\\n color: var(--gray-1);\\n}\\n\",\"js\":\"\",\"html_pre_processor\":\"none\",\"css_pre_processor\":\"none\",\"js_pre_processor\":\"none\",\"html_classes\":\"anchoring-support\",\"css_starter\":\"neither\",\"js_library\":null,\"created_at\":\"2023-02-24T15:07:19.936Z\",\"updated_at\":\"2023-02-28T16:11:01.542Z\",\"title\":\"Anchor Positioning Input Indicator Transitions\",\"description\":\"\",\"slug_hash\":\"qBMaOeL\",\"head\":\"\",\"private\":false,\"has_animation\":true,\"team_id\":0,\"css_prefix\":\"neither\",\"template\":false,\"parent_id\":0,\"comments_count\":0,\"custom_screenshot_filename\":null,\"loves_count\":0,\"pick\":false,\"popularity_score\":0,\"views_count\":0,\"pick_visible_at\":null,\"cpid\":\"018683f6-e000-71da-9d1a-996c36e60b96\",\"is_new_editor_pen\":false,\"protected\":false,\"access\":\"Public\",\"pen_hash\":null}","__processorsMap":{"autoprefixer":"autoprefixer-10","babel":"babel-7","coffeescript":"coffeescript-2","format-1":"format-1","flutter":"flutter-1","haml":"haml-4","less":"less-3","lint-1":"lint-1","livescript":"livescript-1","markdown":"markdown-11","postcss":"postcss-7","pug":"pug-2","sass":"sass-1","scss":"sass-1","sass-ruby-3":"sass-ruby-3","sass-ruby-compass-3":"sass-ruby-compass-3","slim":"slim-3","stylus":"stylus-0","typescript":"typescript-4","vue":"vue-2","vue3":"vue-3"},"__favicon_mask_icon":"https://cpwebassets.codepen.io/assets/favicon/logo-pin-b4b4269c16397ad2f0f7a01bcdf513a1994f4c94b8af2f191c09eb0d601762b1.svg","__favicon_shortcut_icon":"https://cpwebassets.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico","__path_to_iframe_console_runner":"https://cpwebassets.codepen.io/assets/editor/iframe/iframeConsoleRunner-6d8bf8b4b479137260842506acbb12717dace0823c023e08b96360e60b0840d9.js","__path_to_iframe_refresh_css":"https://cpwebassets.codepen.io/assets/editor/iframe/iframeRefreshCSS-44fe83e49b63affec96918c9af88c0d80b209a862cf87ac46bc933074b8c557d.js","__path_to_iframe_runtime_errors":"https://cpwebassets.codepen.io/assets/editor/iframe/iframeRuntimeErrors-4f205f2c14e769b448bcf477de2938c681660d5038bc464e3700256713ebe261.js","__path_to_processor_worker":"https://cpwebassets.codepen.io/assets/packs/router.js","__path_to_stop_execution_on_timeout":"https://cpwebassets.codepen.io/assets/common/stopExecutionOnTimeout-2c7831bb44f98c1391d6a4ffda0e1fd302503391ca806e7fcc7b9b87197aec26.js","__pen_normalize_css_url":"https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css","__pen_prefix_free_url":"https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js","__pen_reset_css_url":"https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css","__path_to_infinite_loop_detection":"https://cpwebassets.codepen.io/assets/packs/js/infiniteLoopDetection-dfafc8f0a577af499f8a.js"}