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\":\"oNPzgaX\",\"auto_save\":true},\"hashid\":\"oNPzgaX\",\"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\":66702045,\"user_id\":5928893,\"html\":\"<div class=\\\"playing\\\">\\n <img src=\\\"https://picsum.photos/300/300?random=1\\\" alt=\\\"Album cover\\\">\\n <div class=\\\"playing__meta\\\">\\n <div class=\\\"details\\\">\\n <div>Some song title</div>\\n <div>Some Artist</div>\\n </div>\\n <div class=\\\"actions\\\">\\n <button>\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\" class=\\\"w-6 h-6\\\">\\n <path stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" d=\\\"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z\\\" />\\n </svg>\\n <span class=\\\"sr-only\\\">Like track</span>\\n </button>\\n <button popovertarget=\\\"context\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\" class=\\\"w-6 h-6\\\">\\n <path stroke-linecap=\\\"round\\\" fill=\\\"none\\\" stroke-width=\\\"2\\\" stroke-linejoin=\\\"round\\\" d=\\\"M4.5 15.75l7.5-7.5 7.5 7.5\\\" />\\n </svg>\\n <span class=\\\"sr-only\\\">Toggle menu</span>\\n </button>\\n <nav popover=\\\"auto\\\" id=\\\"context\\\">\\n <ul>\\n <li>Add to queue</li>\\n <hr>\\n <li>Go to song radio</li>\\n <li>Go to artist</li>\\n <li>Go to album</li>\\n <li>Show credits</li>\\n <hr>\\n <li>Save to your Liked Songs</li>\\n <li>\\n <button popovertarget=\\\"playlist\\\">\\n <span>Add to playlist</span>\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\" class=\\\"w-6 h-6\\\">\\n <path stroke-linecap=\\\"round\\\" fill=\\\"none\\\" stroke-width=\\\"2\\\" stroke-linejoin=\\\"round\\\" d=\\\"M4.5 15.75l7.5-7.5 7.5 7.5\\\" />\\n </svg>\\n </button>\\n </li>\\n <hr>\\n <li>\\n <button popovertarget=\\\"share\\\">\\n <span>Share</span>\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\" class=\\\"w-6 h-6\\\">\\n <path stroke-linecap=\\\"round\\\" fill=\\\"none\\\" stroke-width=\\\"2\\\" stroke-linejoin=\\\"round\\\" d=\\\"M4.5 15.75l7.5-7.5 7.5 7.5\\\" />\\n </svg>\\n </button>\\n </li>\\n </ul>\\n </nav>\\n <div popover=\\\"auto\\\" id=\\\"share\\\">\\n <ul>\\n <li>Copy Song Link</li>\\n <li>Embed track</li>\\n </ul>\\n </div>\\n <div popover=\\\"auto\\\" id=\\\"playlist\\\">\\n <ul>\\n <li>\\n <input type=\\\"search\\\" placeholder=\\\"Find a playlist\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\" class=\\\"w-6 h-6\\\">\\n <path stroke-linecap=\\\"round\\\" fill=\\\"none\\\" stroke=\\\"var(--text-1)\\\" stroke-linejoin=\\\"round\\\" d=\\\"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z\\\" />\\n </svg>\\n </li>\\n <li>Create playlist</li>\\n <hr>\\n <li>5 Star</li>\\n <li>Lofi</li>\\n <li>Valentine's</li>\\n <li>Rock</li>\\n <li>Chill</li>\\n <li>Liked</li>\\n <li>Changing Room</li>\\n </ul>\\n </div>\\n </div>\\n </div>\\n</div>\\n<select>\\n <option value=center>Content Position</option>\\n <option value=top>Top</option>\\n <option value=right>Right</option>\\n <option value=bottom>Bottom</option>\\n <option value=left>Left</option>\\n <option value=center>Center</option>\\n</select>\",\"css\":\"@layer demo {\\n [popovertarget=\\\"share\\\"] {\\n anchor-name: --share;\\n }\\n [popovertarget=\\\"playlist\\\"] {\\n anchor-name: --playlist;\\n }\\n [popovertarget=\\\"context\\\"] {\\n anchor-name: --context;\\n }\\n :root:has(#context:open) [popovertarget=\\\"context\\\"] svg {\\n rotate: 180deg;\\n }\\n :root:has(#share:open) [popovertarget=\\\"share\\\"] svg,\\n :root:has(#playlist:open) [popovertarget=\\\"playlist\\\"] svg {\\n --rotate: 1;\\n }\\n #share {\\n anchor-default: --share;\\n position-fallback: --aligned;\\n }\\n\\n #playlist {\\n anchor-default: --playlist;\\n position-fallback: --aligned;\\n }\\n\\n #context {\\n anchor-default: --context;\\n position-fallback: --flip;\\n }\\n\\n [popover] {\\n inset: unset;\\n }\\n\\n @position-fallback --aligned {\\n @try {\\n top: anchor(top);\\n left: anchor(right);\\n }\\n @try {\\n top: anchor(bottom);\\n left: anchor(right);\\n }\\n @try {\\n top: anchor(top);\\n right: anchor(left);\\n }\\n @try {\\n bottom: anchor(bottom);\\n left: anchor(right);\\n }\\n @try {\\n right: anchor(left);\\n bottom: anchor(bottom);\\n }\\n }\\n @position-fallback --flip {\\n @try {\\n bottom: anchor(top);\\n left: anchor(left);\\n }\\n @try {\\n right: anchor(right);\\n bottom: anchor(top);\\n }\\n @try {\\n top: anchor(bottom);\\n left: anchor(left);\\n }\\n @try {\\n top: anchor(bottom);\\n right: anchor(right);\\n }\\n }\\n}\\n\\n[popovertarget] svg {\\n transition: rotate 0.2s, transform 0.2s;\\n}\\n\\nli {\\n white-space: nowrap;\\n}\\n\\n[popover] ul {\\n font-size: var(--font-size-1);\\n color: var(--text-2);\\n}\\n\\n[type=\\\"search\\\"] {\\n anchor-name: --search;\\n}\\n\\n[type=\\\"search\\\"] + svg {\\n position: absolute;\\n width: var(--size-4);\\n left: anchor(--search left);\\n top: anchor(--search center);\\n translate: var(--size-2) 0%;\\n}\\n\\n:is(button, input):focus-visible {\\n background: var(--surface-2);\\n outline-color: transparent;\\n transition: none;\\n outline-width: 0;\\n}\\n\\n[popover] {\\n opacity: var(--open, 0);\\n scale: calc(0.9 + (var(--open, 0) * 0.1));\\n transition: opacity 0.2s, scale 0.2s, top 0.2s, right 0.2s, left 0.2s,\\n bottom 0.2s;\\n box-shadow: var(--shadow-5);\\n}\\n\\n[popover]:open {\\n --open: 1;\\n}\\n\\nli {\\n position: relative;\\n}\\n\\nli svg {\\n width: 24px;\\n position: absolute;\\n right: var(--size-4);\\n top: 50%;\\n transition: transform 0.2s;\\n transform: translate(0, -50%)\\n rotate(calc((var(--rotate, 0) * 180deg) + 90deg));\\n}\\n\\n.actions li:has(button, input) {\\n padding: 0;\\n}\\n\\n[type=\\\"search\\\"] {\\n border-radius: 0;\\n padding: var(--size-4);\\n padding-left: 2.5rem;\\n}\\n\\nbody:has([value=\\\"top\\\"]:checked) {\\n align-content: start;\\n}\\nbody:has([value=\\\"right\\\"]:checked) {\\n justify-content: end;\\n}\\nbody:has([value=\\\"bottom\\\"]:checked) {\\n align-content: end;\\n}\\nbody:has([value=\\\"left\\\"]:checked) {\\n justify-content: left;\\n}\\nbody:has([value=\\\"center\\\"]:checked) {\\n align-items: center;\\n}\\n\\n*,\\n*:after,\\n*:before {\\n box-sizing: border-box;\\n}\\n\\nbody {\\n display: grid;\\n place-items: center;\\n min-height: 100vh;\\n font-family: \\\"Google Sans\\\", sans-serif, system-ui;\\n background: var(--surface-1);\\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.actions > button {\\n width: 44px;\\n aspect-ratio: 1;\\n padding: 0;\\n display: grid;\\n place-items: center;\\n border-radius: var(--radius-2);\\n}\\n\\n.actions ul {\\n list-style-type: none;\\n padding: 0;\\n display: grid;\\n}\\n\\nul button {\\n width: 100%;\\n text-align: left;\\n position: relative;\\n padding: var(--size-3);\\n}\\n\\nul button svg {\\n height: var(--size-6);\\n}\\n\\n.actions li {\\n padding: var(--size-3);\\n}\\n\\n.actions li:hover {\\n background: var(--surface-3);\\n}\\n\\nhr {\\n border-top: 1px solid var(--text-2);\\n margin: var(--size-0);\\n}\\n\\nimg {\\n width: 100%;\\n object-fit: cover;\\n}\\n\\n.playing__meta {\\n padding: var(--size-3);\\n display: flex;\\n justify-content: space-between;\\n gap: var(--size-3);\\n align-items: center;\\n}\\n\\n.details {\\n font-size: var(--font-size-1);\\n font-weight: var(--font-weight-9);\\n color: var(--text-1);\\n display: grid;\\n gap: var(--size-1);\\n}\\n\\n.details div:last-of-type {\\n font-size: var(--font-size-0);\\n font-weight: var(--font-weight-2);\\n color: var(--text-2);\\n}\\n\\nselect {\\n position: fixed;\\n top: var(--size-2);\\n right: var(--size-2);\\n padding: var(--size-2);\\n z-index: 2;\\n}\\n\\n.actions {\\n display: flex;\\n}\\n\\nbutton {\\n background: none;\\n}\\n\\nbutton:hover {\\n background: var(--surface-2);\\n}\\n\\n.actions > button svg {\\n width: 65%;\\n}\\n\\nbutton svg {\\n stroke: var(--text-2);\\n fill: none;\\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-24T13:23:46.346Z\",\"updated_at\":\"2023-02-28T16:10:43.632Z\",\"title\":\"Anchor Positioning Context Menus\",\"description\":\"\",\"slug_hash\":\"oNPzgaX\",\"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\":\"01868398-102a-7177-b0af-4627a1482fc9\",\"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"}