|
/* |
|
Native <details> element styling |
|
AUTHOR: https://codepen.io/nicolasjengler |
|
|
|
+ replaced list-item styling with flex and pseudo-element content on summary => vertically aligned sign with summary content |
|
+ added selection and focus outline matching detail style |
|
+ addede custom list-style-type |
|
- corona-warning |
|
- corona-info |
|
- corona-alert |
|
+ fix body hehight –> min-height: |
|
allow scroll on all details opened |
|
*/ |
|
|
|
|
|
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap'); |
|
|
|
:root { |
|
--color-bg: #EEEDEB; |
|
--color-title: #0E1C4E; |
|
|
|
--color-summary-1: #FFF6EE; |
|
--color-summary-1-highlight: #FFC48B; |
|
--color-summary-2: #FAFAFF; |
|
--color-summary-2-highlight: #B4B3FF; |
|
--color-summary-3: #FFF0F3; |
|
--color-summary-3-highlight: #FFB3C0; |
|
|
|
--font-ibm-plex-sans: 'IBM Plex Sans', sans-serif; |
|
} |
|
|
|
html, |
|
body { |
|
overflow: auto; |
|
min-height: 100vh; |
|
width: 100%; |
|
background: var(--color-bg); |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
} |
|
|
|
.card { |
|
background: white; |
|
padding: 38px 36px; |
|
margin-top: 40px; |
|
margin-bottom: 40px; |
|
border-radius: 4px; |
|
box-shadow: 0 8px 10px rgba(0, 0, 0, .1); |
|
max-width: 30em; |
|
width: 100%; |
|
|
|
h1 { |
|
font-family: var(--font-ibm-plex-sans); |
|
font-style: normal; |
|
font-weight: bold; |
|
font-size: 20px; |
|
line-height: 1.2; |
|
color: var(--color-title); |
|
margin-bottom: 20px; |
|
} |
|
|
|
details { |
|
display: flex; |
|
|
|
border-radius: 5px; |
|
overflow: hidden; |
|
background: rgba(0, 0, 0, .05); |
|
border-left: 15px solid gray; |
|
padding:15px; |
|
& { |
|
margin-top: 15px; |
|
} |
|
|
|
&.warning { |
|
--highlight: var(--color-summary-1-highlight) ; |
|
background: var(--color-summary-1); |
|
border-left-color: var(--color-summary-1-highlight); |
|
p { |
|
list-style-type: corona-warning; |
|
} |
|
} |
|
|
|
&.info { |
|
--highlight: var(--color-summary-2-highlight) ; |
|
background: var(--color-summary-2); |
|
border-left-color: var(--color-summary-2-highlight); |
|
p { |
|
list-style-type: corona-info; |
|
} |
|
} |
|
|
|
&.alert { |
|
--highlight: var(--color-summary-3-highlight) ; |
|
background: var(--color-summary-3); |
|
border-left-color: var(--highlight); |
|
p { |
|
list-style-type: corona-alert; |
|
} |
|
} |
|
|
|
summary,p { |
|
position:relative; |
|
display:flex; |
|
flex-direction:row; |
|
align-content: center; |
|
justify-content: flex-start; |
|
font-family: var(--font-ibm-plex-sans); |
|
font-style: normal; |
|
font-weight: normal; |
|
font-size: 18px; |
|
color: var(--color-title); |
|
padding: 20px; |
|
cursor:pointer; |
|
&::-webkit-details-marker { |
|
display:none; |
|
} |
|
&:focus { |
|
outline: solid 3px var(--highlight); |
|
} |
|
&::selection { |
|
background-color:var(--highlight); |
|
} |
|
} |
|
p { |
|
display: list-item; |
|
cursor:default; |
|
margin-left:3rem; |
|
list-style-type: corona; |
|
} |
|
|
|
summary::before { |
|
cursor: pointer; |
|
position:absolute; |
|
display:inline-flex; |
|
width:1rem; |
|
height:1rem; |
|
left: 0rem; |
|
margin-right:.5rem; |
|
content: url("data:image/svg+xml,%3Csvg width='100%' height='100%' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M22.6066 12H1.3934' stroke='%23202842' stroke-width='1.875' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12 1.39343V22.6066' stroke='%23202842' stroke-width='1.875' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A"); |
|
|
|
} |
|
|
|
&[open] { |
|
summary { |
|
|
|
font-weight: 700; |
|
|
|
&::before { |
|
transform: rotate(45deg); |
|
content: url("data:image/svg+xml,%3Csvg width='100%' height='100%' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M22.6066 12H1.3934' stroke='%23202842' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12 1.39343V22.6066' stroke='%23202842' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A"); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
@counter-style corona-warning { |
|
system: cyclic; |
|
symbols: 🧼 🩺 👩🏻⚕️ 🚑; |
|
suffix: " "; |
|
} |
|
@counter-style corona-info { |
|
system: cyclic; |
|
symbols: 🧬; |
|
suffix: " "; |
|
} |
|
@counter-style corona-alert { |
|
system: fixed; |
|
symbols: 💉 🩸 😷 🦠 🧫; |
|
suffix: " "; |
|
} |