Whakerexa > Layout > Containers

Containers

layout.css provides layout containers and a card component for Whakerexa pages. Load it after wexa.css:

<link rel="stylesheet" href=".../wexa_statics/css/wexa.css" media="screen" />
<link rel="stylesheet" href=".../wexa_statics/css/layout.css" media="all" />

Variables

layout.css exposes the following CSS variables:

Variable Role Default
--card-bg-color Card background — undeclared, so the fallback is resolved on the card itself var(--bg-color-alt)
--card-fg-color Card text color — undeclared, so the fallback is resolved on the card itself var(--fg-color)
--panel-bg-color Reference background of odd .panel-item sections var(--bg-color)
--panel-fg-color Reference text color of odd .panel-item sections var(--fg-color)
--panel-bg-color-alt Reference background of even .panel-item sections var(--bg-color-alt)
--panel-fg-color-alt Reference text color of even .panel-item sections var(--fg-color-alt)
--card-padding Inner padding; header and footer bleed to edges 0.6rem
--card-max-width Max width of cards inside .cards-panel 15rem
--border-width-alt Border width of a frame, a card among them 1px
--border-radius-alt Corner radius of a frame, a card among them 0.5rem
--card-box-shadow Card drop shadow -0.1rem 0.1rem 0.4rem 0.1rem var(--shadow-color)
--columns-sep-color Color for .flex-border-left separators rgba(128, 128, 128, 0.5)

Simple panel

Use .panel for a basic block container that clears floats.

Panel content

<div class="panel">
    Content
</div>

Scrolled panel

Use .scrolled-panel for a container with scrollable overflow. Set an explicit height to activate scrolling.

Line 1

Line 2

Line 3

Line 4

Line 5

<div class="scrolled-panel" style="height: 4rem;">
    <!-- content taller than container -->
</div>

Flex panel

Use .flex-panel for a responsive row of items. Each child takes .flex-item. Width helpers (.width_30, .width_60, etc.) control proportions. On narrow screens the layout collapses to a single column. Add .flex-border-left to a .flex-item for a vertical separator.

30 %

40 %

20 %

<div class="flex-panel">
    <p class="flex-item width_30">30 %</p>
    <p class="flex-item width_40 flex-border-left">40 %</p>
    <p class="flex-item width_20 flex-border-left">20 %</p>
</div>

Grid panel

Use .grid-panel for an equal-column auto-fit grid. Items use .grid-item. The number of columns adapts to the available space.

Cell 1

Cell 2

Cell 3

Cell 4

<div class="grid-panel">
    <p class="grid-item">Cell 1</p>
    <p class="grid-item">Cell 2</p>
    <p class="grid-item">Cell 3</p>
</div>

Wrap panel

Use .wrap-panel for a row of items that keep their natural size and wrap to a new line only when space runs out. Each child takes .wrap-item. Unlike .flex-panel, there is no forced single-column collapse on narrow screens — wrapping follows the actual available space.

Short item

A bit longer item

Even longer longer longer item

Yet another longer longer item

<div class="wrap-panel">
    <p class="wrap-item">Short item</p>
    <p class="wrap-item">A bit longer item</p>
    <p class="wrap-item">Even longer longer longer item</p>
    <p class="wrap-item">Yet another longer longer item</p>
</div>

A panel written as a list

When a panel holds a set — three themes, four cells, a row of cards — write it as a list, and a reader who listens is told it is one. Any of the panels above takes <ul> or <ol> in place of its container, and <li> in place of each item. The square the framework draws before an item is not drawn there, and the room it reserves is not taken: the item is the place the panel gives.

  • First
  • Second
  • Third
<ul class="wrap-panel">
    <li class="wrap-item">First</li>
    <li class="wrap-item">Second</li>
    <li class="wrap-item">Third</li>
</ul>

Collapsible panel

Use the native HTML <details> / <summary> elements. No CSS class required — wexa.css styles them directly. Keyboard-accessible: Tab to focus, Enter or Space to toggle.

Toggle me

Hidden content revealed on click.

<details>
    <summary>Toggle me</summary>
    <p>Hidden content.</p>
</details>

Cards

Use .card on an <article> or <section> element. A card can contain up to three zones: .card-header, .card-body, .card-footer. Group cards in a .cards-panel container for a responsive grid layout.

Card title

Card content — wraps when needed.

Learn more
<article class="card">
    <div class="card-body">
        <h2>Card title</h2>
        <p>Content</p>
        <a href="#" class="more-link">Learn more</a>
    </div>
</article>
<article class="card">
    <div class="card-header"><h2>Title</h2></div>
    <div class="card-body"><p>Content</p></div>
    <div class="card-footer">
        <a href="#">Link</a>
    </div>
</article>

Card A

First card in the grid.

Card B

Second card in the grid.

Card C

Third card in the grid.

<section class="cards-panel">
    <article class="card">
        <div class="card-header">...</div>
        <div class="card-body">...</div>
        <div class="card-footer">...</div>
    </article>
</section>

A .full-card inside a .full-cards-panel spans the full available width — suitable for featured content.

<section class="full-cards-panel">
    <article class="card full-card">
        <div class="card-body">...</div>
        <div class="card-footer">...</div>
    </article>
</section>

A drawing beside what it illustrates

.illustrated-content gives a drawing a share of the width and the text the rest. Under 640 px, where two columns would leave lines too short to read, one follows the other and the text is centred. The drawing is the <img>; what it illustrates is whatever else the container holds.

The logo of Whakerexa

What it is for

A figure and what it says, side by side, without a panel and without a class on each of the two.

<div class="illustrated-content">
    <img src="logo.webp" alt="...">
    <section>...</section>
</div>

Two utilities and the size of a logo

.flow puts one space between what follows what, and none before the first: the container says the distance once, and each element after the first takes it. A child that wants another distance writes --flow-space on itself. .noborder removes a border.

.small-logo, .medium-logo and .large-logo bound an image by its height on a wide screen — 3.5, 6.5 and 10 rem — and by its width on a narrow one. The other side is left free, so the drawing keeps its shape.

This paragraph asks for twice the distance.

<div class="flow">
    <img src="logo.webp" alt="..." class="small-logo">
    <img src="logo.webp" alt="..." class="medium-logo">
    <p style="--flow-space: 2rem;">...</p>
</div>

Alternating section backgrounds

Direct .panel-item children of <main> alternate their background. Odd sections use --bg-color, even sections use --bg-color-alt.

The two colors are swapped, not overwritten: inside an even section, --bg-color-alt takes the value of the page background. Nested elements that build their contrast on that pair — cards, code blocks — therefore stay visible in both cases.

The card below sits in an odd section.

Card on an odd section — background is --bg-color-alt.

Alternating backgrounds — even section

Same markup, in an even section. The card keeps a background distinct from the section: both must remain readable.

Card on an even section — background is the swapped --bg-color-alt, that is the page background color.