Home
001 - Basic
002 - Variables
003 - Layer
004 - Nested Rules
010 - Grid
011 - Grid Complex
012 - Grid Contents
013 - Grid Logos
014 - Grid Spanning
020 - Container
021 - Container Style Queries
030 - Focus Visible
031 - Focus Within
040 - Color Scheme
041 - Color Light-Dark
042 - Color Mix
043 - Color Mix Mixer
044 - Color Mix Palette
045 - Relative Color
046 - Relative Color Palette
050 - Mask Image
051 - Background Clip Text
060 - Accent Color
070 - Has
071 - Starting Style
072 - Transition Behavior
073 - Anchor Position
090 - Text Wrap
100 - Popover
101 - Details Element
110 - Scroll Driven Animations
120 - Customizable Select
999 - Playground
Loading ...
CSS
-a
+A
:root { --popover-color: #313131; --popover-bg: #fafafa; --popover-border-color: #cacaca; --popover-border-radius: .5rem; --popover-padding-y: 1.5rem; --popover-padding-x: 1.5rem; --popover-shadow: 0 0 5px 5px rgba(0, 0, 0, .25); } .popover { color: var(--popover-color); background: var(--popover-bg); border-radius: var(--popover-border-radius); padding: var(--popover-padding-y) var(--popover-padding-x); box-shadow: 0 0 2px 1px rgba(0, 0, 0, .15); border: 1px solid var(--popover-border-color); padding-inline-end: calc(var(--popover-padding-x) * 3); width: clamp(150px, 80vw, 600px); &::backdrop { background: linear-gradient( color-mix(in srgb, #e66465, transparent 50%), color-mix(in srgb, #9198e5, transparent 50%) ); } } .popover-close { position: absolute; top: calc(var(--popover-padding-y) / 2); inset-inline-end: calc(var(--popover-padding-x) / 2); height: calc(var(--popover-padding-x) * 1.5); width: calc(var(--popover-padding-y) * 1.5); background: transparent; margin: 0; padding: 0; border-radius: calc(var(--popover-border-radius) / 2); border: 1px solid transparent; cursor: pointer; filter: grayscale(); &:hover { border-color: var(--popover-border-color); } } .popover-content { *:first-child { margin-top: 0; } *:last-child { margin-bottom: 0; } }
HTML
-a
+A
<div class="container"> <button type="button" id="popover-toggle" popovertarget="popover" class="btn"> Open </button> </div> <div class="popover" id="popover" popover> <button type="button" class="popover-close" popovertarget="popover" popovertargetaction="hide"> <span aria-hidden="true">❌</span> <span class="sr-only">Close</span> </button> <div class="popover-content"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut scelerisque tempus pulvinar. Vivamus tellus lacus, posuere quis justo eget, suscipit ultrices neque. Suspendisse potenti. Vestibulum ut sem non mauris semper lobortis. Donec quis quam lorem. Donec mattis consequat massa sed rhoncus. Duis vel tempor odio. Mauris sit amet est at felis viverra laoreet vitae ac enim. Donec accumsan purus nec tortor cursus congue.</p> </div> </div> <div class="form"> <div class="form-section"> <label for="popoverMode">popover:</label> <select id="popoverMode" data-trigger="change" data-target="#popover" data-attribute="popover" > <option value="auto">auto</option> <option value="manual">manual</option> </select> </div> </div>
Off
1/2
1/1
2/1
Zoom
Document
Container