---
title: "X 归档 2022-03-19"
date: "2022-03-19"
tags:
  - x-archive
  - frontend
---

<div class="x-arch-meta">6 条动态 · 图 1 · 视频 1</div>
<div class="x-arch-day">
  <div class="x-arch-item">
    <input type="radio" name="xl-1504893095661424644" id="xl-1504893095661424644-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1504893095661424644" id="xl-1504893095661424644-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/3064529098/d3947949d09c52024b67b1ba34aa8e73_bigger.png" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-liked" aria-label="赞" title="赞"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></svg></span><a class="x-arch-author" href="https://x.com/gaubeebangeel" target="_blank" rel="nofollow noopener" data-name="gaubeebangeel" data-avatar="https://twimg.tweb.xin/twimg/profile_images/3064529098/d3947949d09c52024b67b1ba34aa8e73_bigger.png">@gaubeebangeel</a><span class="x-arch-time">02:50</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1504893095661424644-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1504893095661424644-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/gaubeebangeel/status/1504893095661424644" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">You’re unable to view this Post because this account owner limits who can view their Posts. {learnmore}</div>
    <div class="x-arch-text x-arch-trans">由于该账号所有者限制了谁可以查看其帖子，你无法查看这条帖子。{learnmore}</div>
  </div>
  <div class="x-arch-item">
    <input type="radio" name="xl-1504941025449906176" id="xl-1504941025449906176-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1504941025449906176" id="xl-1504941025449906176-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1416949812616855554/JSPgOlH9_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-liked" aria-label="赞" title="赞"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></svg></span><a class="x-arch-author" href="https://x.com/samthor" target="_blank" rel="nofollow noopener" data-name="sam &quot;zero​width​space&quot; thor" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1416949812616855554/JSPgOlH9_bigger.jpg">@samthor</a><span class="x-arch-time">06:01</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1504941025449906176-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1504941025449906176-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/samthor/status/1504941025449906176" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">What is JavaScript missing. A thread: 🧵</div>
    <div class="x-arch-text x-arch-trans">JavaScript 还缺什么。一个串：🧵</div>
  </div>
  <div class="x-arch-item">
    <input type="radio" name="xl-1504979351741386763" id="xl-1504979351741386763-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1504979351741386763" id="xl-1504979351741386763-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1896994823145398272/Upz9Ljct_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-liked" aria-label="赞" title="赞"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></svg></span><a class="x-arch-author" href="https://x.com/claviska" target="_blank" rel="nofollow noopener" data-name="Cory LaViska" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1896994823145398272/Upz9Ljct_bigger.jpg">@claviska</a><span class="x-arch-time">08:33</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1504979351741386763-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1504979351741386763-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/claviska/status/1504979351741386763" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">CSS Anchored Positioning: <a href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md" target="_blank" rel="noopener">https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md</a><br /><br />If you've ever used Popper.js, this will be of interest to you. Imagine positioning top layer popovers with pure CSS! 🤩</div>
    <div class="x-arch-text x-arch-trans">CSS Anchored Positioning：<a href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md" target="_blank" rel="noopener">https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md</a><br /><br />如果你用过 Popper.js，这会让你感兴趣。想象一下用纯 CSS 定位顶层 popover！🤩</div>
  </div>
  <div class="x-arch-item">
    <input type="radio" name="xl-1505037154870722569" id="xl-1505037154870722569-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1505037154870722569" id="xl-1505037154870722569-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1797295749866164224/1SD8Fh7G_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-posted" aria-label="发" title="发"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /><path d="m15 5 4 4" /></svg></span><a class="x-arch-author" href="https://x.com/shadeed9" target="_blank" rel="nofollow noopener" data-name="Ahmad Shadeed" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1797295749866164224/1SD8Fh7G_bigger.jpg">@shadeed9</a><span class="x-arch-time">12:23</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1505037154870722569-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1505037154870722569-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/shadeed9/status/1505037154870722569" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">CSS Tip 💡<br /><br />Use a dynamic line separator that changes from horizontal to vertical depending on flex-direction. No need for width or height. Just a stretched CSS border!<br /><br />Details: <a href="https://ishadeed.com/article/flexbox-separator/" target="_blank" rel="noopener">https://ishadeed.com/article/flexbox-separator/</a></div>
    <div class="x-arch-text x-arch-trans">CSS 小技巧 💡<br /><br />使用一条动态分隔线，根据 flex-direction 在水平与垂直之间切换。不需要设置宽高，只要一条被拉伸的 CSS border 就行！<br /><br />详情：<a href="https://ishadeed.com/article/flexbox-separator/" target="_blank" rel="noopener">https://ishadeed.com/article/flexbox-separator/</a></div>
    <div class="x-arch-media">
      <a href="/cdn-media/x/2022-03/1505037154870722569-1.jpg" target="_blank" rel="noopener"><img class="x-arch-img" src="/cdn-media/x/2022-03/1505037154870722569-1.jpg" alt="@shadeed9 的配图 1/1" loading="lazy" decoding="async" width="2024" height="1012" /></a>
    </div>
  </div>
  <div class="x-arch-item">
    <input type="radio" name="xl-1505037558668939268" id="xl-1505037558668939268-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1505037558668939268" id="xl-1505037558668939268-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1896994823145398272/Upz9Ljct_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-posted" aria-label="发" title="发"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /><path d="m15 5 4 4" /></svg></span><a class="x-arch-author" href="https://x.com/claviska" target="_blank" rel="nofollow noopener" data-name="Cory LaViska" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1896994823145398272/Upz9Ljct_bigger.jpg">@claviska</a><span class="x-arch-time">12:24</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1505037558668939268-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1505037558668939268-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/claviska/status/1505037558668939268" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">CSS Anchored Positioning: <a href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md" target="_blank" rel="noopener">https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md</a><br /><br />If you've ever used Popper.js, this will be of interest to you. Imagine positioning top layer popovers with pure CSS! 🤩</div>
    <div class="x-arch-text x-arch-trans">CSS Anchored Positioning：<a href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md" target="_blank" rel="noopener">https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/CSSAnchoredPositioning/explainer.md</a><br /><br />如果你用过 Popper.js，这会让你感兴趣。想象一下用纯 CSS 定位顶层 popover！🤩</div>
  </div>
  <div class="x-arch-item">
    <input type="radio" name="xl-1505159905044541444" id="xl-1505159905044541444-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1505159905044541444" id="xl-1505159905044541444-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1797295749866164224/1SD8Fh7G_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-liked" aria-label="赞" title="赞"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></svg></span><a class="x-arch-author" href="https://x.com/shadeed9" target="_blank" rel="nofollow noopener" data-name="Ahmad Shadeed" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1797295749866164224/1SD8Fh7G_bigger.jpg">@shadeed9</a><span class="x-arch-time">20:31</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1505159905044541444-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1505159905044541444-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/shadeed9/status/1505159905044541444" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">We can take this further and use CSS container queries to toggle between flex-direction: row or column based on the parent width!<br /><br />Demo (Chrome canary): <a href="https://codepen.io/shadeed/pen/vYpGjZY?editors=1100" target="_blank" rel="noopener">https://codepen.io/shadeed/pen/vYpGjZY?editors=1100</a> <a href="https://t.co/66hxhmbCvt" target="_blank" rel="noopener">https://t.co/66hxhmbCvt</a></div>
    <div class="x-arch-text x-arch-trans">我们还能更进一步，用 CSS container queries 根据父元素宽度在 flex-direction: row 和 column 之间切换！<br /><br />演示（Chrome canary）： <a href="https://t.co/66hxhmbCvt" target="_blank" rel="noopener">https://t.co/66hxhmbCvt</a></div>
    <video class="x-arch-video" preload="none" playsinline poster="/cdn-media/x/2022-03/1505159905044541444-poster.jpg" src="/cdn-media/x/2026-10/1505159905044541444-video.mp4" width="1470" height="720" data-duration="11" aria-label="@shadeed9 的视频"></video>
  </div>
</div>
