Back to CSS Sidebar Layouts Adaptive Container-query Pure CSS
Share
.sb-cnt-wrap {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: #5ce064;
  container-type: inline-size;
}
.sb-cnt {
  position: relative;
  display: grid; grid-template-columns: 220px 1fr;
  min-height: 480px;
  background: #060a07;
  border-radius: 6px; overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(92,224,100,0.3);
}
.sb-cnt-glow {
  position: absolute; left: 0; right: 0; bottom: 0; height: 60%;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(80% 60% at 50% 100%, rgba(255,140,40,0.32), transparent 70%),
    radial-gradient(40% 30% at 50% 100%, rgba(255,210,80,0.4), transparent 70%);
}
.sb-cnt-scan {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
}
.sb-cnt-side {
  position: relative; z-index: 1;
  background: rgba(8,14,10,0.85);
  border-right: 1px solid rgba(92,224,100,0.3);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.sb-cnt-brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 4px 14px; border-bottom: 1px dashed rgba(92,224,100,0.3); text-decoration: none; }
.sb-cnt-prompt { color: #ffaa44; font-size: 16px; font-weight: 800; text-shadow: 0 0 10px rgba(255,170,68,0.5); }
.sb-cnt-name { font-size: 16px; font-weight: 700; color: #5ce064; letter-spacing: 0.04em; text-shadow: 0 0 8px rgba(92,224,100,0.4); line-height: 1; }
.sb-cnt-name small { font-size: 12px; color: #ffaa44; font-weight: 700; }
.sb-cnt-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.sb-cnt-side a {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 10px;
  font-size: 13px; color: #5ce064; text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.14s, color 0.14s, border-color 0.14s, text-shadow 0.14s;
}
.sb-cnt-side a em { font-style: normal; font-size: 11px; font-weight: 700; color: rgba(92,224,100,0.5); width: 18px; }
.sb-cnt-side a:hover { background: rgba(92,224,100,0.08); color: #fff; border-left-color: #5ce064; text-shadow: 0 0 8px rgba(92,224,100,0.6); }
.sb-cnt-side a[aria-current="page"] { background: rgba(255,170,68,0.12); color: #ffaa44; border-left-color: #ffaa44; text-shadow: 0 0 10px rgba(255,170,68,0.6); }
.sb-cnt-side a[aria-current="page"] em { color: #ffaa44; }
.sb-cnt-side footer { margin-top: auto; padding-top: 10px; border-top: 1px dashed rgba(92,224,100,0.3); font-size: 11px; color: #5ce064; letter-spacing: 0.06em; opacity: 0.8; }
.sb-cnt-cursor { color: #ffaa44; animation: sb-cnt-blink 1s steps(1) infinite; }
@keyframes sb-cnt-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sb-cnt-cursor { animation: none; } }
.sb-cnt-main { position: relative; z-index: 1; padding: 30px 32px; display: flex; flex-direction: column; gap: 16px; }
.sb-cnt-eye { font-size: 11.5px; color: rgba(92,224,100,0.6); letter-spacing: 0.04em; font-style: italic; }
.sb-cnt-main h2 {
  margin: 0; font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: clamp(32px, 5vw, 56px); font-weight: 800; line-height: 0.95;
  color: #5ce064; letter-spacing: -0.02em;
  text-shadow: 0 0 20px rgba(92,224,100,0.4);
}
.sb-cnt-main p { margin: 0; font-family: 'Inter', system-ui, sans-serif; font-size: 13.5px; color: rgba(214,235,218,0.9); line-height: 1.65; max-width: 480px; }
.sb-cnt-main em { color: #ffaa44; font-style: normal; font-weight: 600; text-shadow: 0 0 8px rgba(255,170,68,0.4); }
.sb-cnt-main strong { color: #5ce064; font-weight: 700; }
.sb-cnt-code { margin: 0; padding: 16px 18px; background: rgba(8,14,10,0.85); border: 1px solid rgba(92,224,100,0.3); border-radius: 4px; font-size: 12px; line-height: 1.7; color: #5ce064; white-space: pre-wrap; box-shadow: inset 0 0 24px rgba(92,224,100,0.05); }
@container (max-width: 600px) {
  .sb-cnt { grid-template-columns: 1fr; }
  .sb-cnt-side { flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px dashed rgba(92,224,100,0.3); overflow-x: auto; }
  .sb-cnt-side ul { flex-direction: row; gap: 4px; flex-shrink: 0; }
  .sb-cnt-side a { padding: 6px 10px; font-size: 12px; }
  .sb-cnt-side footer, .sb-cnt-brand { display: none; }
}
<div class="sb-cnt-wrap">
  <div class="sb-cnt">
    <span class="sb-cnt-glow" aria-hidden="true"></span>
    <span class="sb-cnt-scan" aria-hidden="true"></span>
    <aside class="sb-cnt-side" aria-label="Primary">
      <a class="sb-cnt-brand" href="#!">
        <span class="sb-cnt-prompt" aria-hidden="true">$</span>
        <span class="sb-cnt-name">vortex<small>.sh</small></span>
      </a>
      <nav aria-label="Primary">
        <ul>
          <li><a href="#!" aria-current="page"><em>01</em>home</a></li>
          <li><a href="#!"><em>02</em>library</a></li>
          <li><a href="#!"><em>03</em>projects</a></li>
          <li><a href="#!"><em>04</em>archive</a></li>
          <li><a href="#!"><em>05</em>settings</a></li>
        </ul>
      </nav>
      <footer><span class="sb-cnt-cursor" aria-hidden="true">▮</span> ready</footer>
    </aside>
    <main class="sb-cnt-main">
      <span class="sb-cnt-eye">/* container-queries.md */</span>
      <h2>Adaptive<br/>by container.</h2>
      <p>Resize the card width — when this <em>container</em> drops below 600px, the sidebar collapses into a top nav. The <strong>viewport</strong> size is irrelevant; the layout reacts to its own parent. Drop this shell into any narrow column and it adapts on its own.</p>
      <pre class="sb-cnt-code">@container (max-width: 600px) {
  .sb-cnt { grid-template-columns: 1fr; }
  .sb-cnt-side { flex-direction: row; }
}</pre>
    </main>
  </div>
</div>
Live preview Edit any tab — preview updates live Ready