diff --git a/docs/index.html b/docs/index.html index b8881fe5f..bca8b7bfd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -31,7 +31,7 @@ .bouncing-loader > div:nth-child(3) { animation-delay: 0.4s; } -

Demo

Explanation

Note: 1rem is usually 16px.

  1. @keyframes defines an animation that has two states, where the element changes opacity and is translated up on the 2D plane using transform: translateY().

  2. .bouncing-loader is the parent container of the bouncing circles and uses display: flex and justify-content: center to position them in the center.

  3. .bouncing-loader > div, targets the three child divs of the parent to be styled. The divs are given a width and height of 1rem, using border-radius: 50% to turn them from squares to circles.

  4. margin: 3rem 0.2rem specifies that each circle has a top/bottom margin of 3rem and left/right margin of 0.2rem so that they do not directly touch each other, giving them some breathing room.

  5. animation is a shorthand property for the various animation properties: animation-name, animation-duration, animation-iteration-count, animation-direction are used.

  6. nth-child(n) targets the element which is the nth child of its parent.

  7. animation-delay is used on the second and third div respectively, so that each element does not start the animation at the same time.

Browser support

95.3%

✅ No caveats.

Box-sizing resetlayout

Resets the box-model so that widths and heights are not affected by their borders or padding.

HTML

<div class="box">border-box</div>
+

Demo

Explanation

Note: 1rem is usually 16px.

  1. @keyframes defines an animation that has two states, where the element changes opacity and is translated up on the 2D plane using transform: translateY().

  2. .bouncing-loader is the parent container of the bouncing circles and uses display: flex and justify-content: center to position them in the center.

  3. .bouncing-loader > div, targets the three child divs of the parent to be styled. The divs are given a width and height of 1rem, using border-radius: 50% to turn them from squares to circles.

  4. margin: 3rem 0.2rem specifies that each circle has a top/bottom margin of 3rem and left/right margin of 0.2rem so that they do not directly touch each other, giving them some breathing room.

  5. animation is a shorthand property for the various animation properties: animation-name, animation-duration, animation-iteration-count, animation-direction are used.

  6. nth-child(n) targets the element which is the nth child of its parent.

  7. animation-delay is used on the second and third div respectively, so that each element does not start the animation at the same time.

Browser support

95.3%

✅ No caveats.

Box-sizing resetlayout

Resets the box-model so that widths and heights are not affected by their borders or padding.

HTML

<div class="box">border-box</div>
 <div class="box content-box">content-box</div>
 

CSS

html {
   box-sizing: border-box;
@@ -495,10 +495,11 @@ li:not(:last-child) {
   padding: 15px;
 }
 .reference:hover > .popout-menu,
-.reference:focus > .popout-menu {
+.reference:focus > .popout-menu,
+.reference:focus-within > .popout-menu {
   visibility: visible;
 }
-

Demo

Popout menu

Explanation

  1. position: relative on the reference parent establishes a Cartesian positioning context for its child.
  2. position: absolute takes the popout menu out of the flow of the document and positions it in relation to the parent.
  3. left: 100% moves the the popout menu 100% of its parent's width from the left.
  4. visibility: hidden hides the popout menu initially and allows for transitions (unlike display: none).
  5. .reference:hover > .popout-menu means that when .reference is hovered over, select immediate children with a class of .popout-menu and change their visibility to visible, which shows the popout.

Browser support

99+%

✅ No caveats.

Pretty text underlinevisual

A nicer alternative to text-decoration: underline where descenders do not clip the underline. Natively implemented as text-decoration-skip-ink: auto but it has less control over the underline.

HTML

<p class="pretty-text-underline">Pretty text underline without clipping descending letters.</p>
+

Demo

Popout menu

Explanation

  1. position: relative on the reference parent establishes a Cartesian positioning context for its child.
  2. position: absolute takes the popout menu out of the flow of the document and positions it in relation to the parent.
  3. left: 100% moves the the popout menu 100% of its parent's width from the left.
  4. visibility: hidden hides the popout menu initially and allows for transitions (unlike display: none).
  5. .reference:hover > .popout-menu means that when .reference is hovered over, select immediate children with a class of .popout-menu and change their visibility to visible, which shows the popout.
  6. .reference:focus > .popout-menu means that when .reference is focused, the popout would be shown.
  7. .reference:focus-within > .popout-menu ensures that the popout is shown when the focus is within the reference.

Browser support

99+%

✅ No caveats.

Pretty text underlinevisual

A nicer alternative to text-decoration: underline where descenders do not clip the underline. Natively implemented as text-decoration-skip-ink: auto but it has less control over the underline.

HTML

<p class="pretty-text-underline">Pretty text underline without clipping descending letters.</p>
 

CSS

.pretty-text-underline {
   display: inline;
   text-shadow: 1px 1px #f5f6f9, -1px 1px #f5f6f9, -1px -1px #f5f6f9, 1px -1px #f5f6f9;
diff --git a/index.html b/index.html
index 619adc8cf..852f85506 100644
--- a/index.html
+++ b/index.html
@@ -2008,7 +2008,8 @@ li:not(:last-child) {
   padding: 15px;
 }
 .reference:hover > .popout-menu,
-.reference:focus > .popout-menu {
+.reference:focus > .popout-menu,
+.reference:focus-within > .popout-menu {
   visibility: visible;
 }
 
@@ -2036,7 +2037,8 @@ li:not(:last-child) { padding: 15px; } [data-scope="popout-menu.md"] .reference:hover>.popout-menu, - [data-scope="popout-menu.md"] .reference:focus>.popout-menu { + [data-scope="popout-menu.md"] .reference:focus>.popout-menu, + [data-scope="popout-menu.md"] .reference:focus-within>.popout-menu { visibility: visible; } @@ -2048,6 +2050,8 @@ li:not(:last-child) {
  • visibility: hidden hides the popout menu initially and allows for transitions (unlike display: none).
  • .reference:hover > .popout-menu means that when .reference is hovered over, select immediate children with a class of .popout-menu and change their visibility to visible, which shows the popout.
  • +
  • .reference:focus > .popout-menu means that when .reference is focused, the popout would be shown.
  • +
  • .reference:focus-within > .popout-menu ensures that the popout is shown when the focus is within the reference.
  • Browser support

    diff --git a/snippets/popout-menu.md b/snippets/popout-menu.md index 55c9dd481..4108b29b9 100644 --- a/snippets/popout-menu.md +++ b/snippets/popout-menu.md @@ -46,7 +46,7 @@ Reveals an interactive popout menu on hover and focus. 4. `visibility: hidden` hides the popout menu initially and allows for transitions (unlike `display: none`). 5. `.reference:hover > .popout-menu` means that when `.reference` is hovered over, select immediate children with a class of `.popout-menu` and change their `visibility` to `visible`, which shows the popout. 6. `.reference:focus > .popout-menu` means that when `.reference` is focused, the popout would be shown. -7. `.reference:focus-within > .popout-menu` ensures that the popout is shown when the focus is *within* the reference. +7. `.reference:focus-within > .popout-menu` ensures that the popout is shown when the focus is _within_ the reference. #### Browser support