Template:Portal styles/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

This is a documentation subpage for Template:Portal styles.
It contains usage information, categories and other content or metadata that is not part of the original template.
This template uses TemplateStyles:


Purpose

Loads the shared CSS classes for OpenStreetMap Wiki portals, hubs, and landing pages. Neutral surfaces, borders, text colors, and warning notices use Wikimedia Codex design tokens for automatic light and dark mode support, paired with OpenStreetMap green brand accents.

Usage

Place {{Portal styles}} near the top of a page, then apply classes from the five families below. For common components, helper templates are available (each loads Template:Portal styles/styles.css automatically):

  • {{Portal intro}} (Template:Portal intro) for editorial heroes with optional logos, quick links, and slim directory bars (layout=bar)
  • {{Portal door}} (Template:Portal door) for focal doorway icons (internal or external url=, icon_set=codex|oojs, layout=row, and optional pillar links=)
  • {{Portal card}} (Template:Portal card) for structured Tier 2 cards with headers, actions, 2-column splits (body2=), and aligned footers
  • {{Portal col}} (Template:Portal col) for Tier 3 borderless editorial columns (including plain=yes)
  • {{Portal note}} (Template:Portal note) for green tips, amber warnings, and neutral asides (inline text= or multi-line body=)
  • {{Portal muted}} (Template:Portal muted) for secondary muted inline text
  • {{Portal jumpbar}} (Template:Portal jumpbar) and {{Portal gallery}} (Template:Portal gallery) for guide section jump bars and 5-image showcase strips
  • {{Portal proposals}}, {{Portal news}}, and {{Portal events}} for dashboard feed cards
  • {{Codex icon}} (Template:Codex icon) and {{OOjs icon}} (Template:OOjs icon) for monochrome card and column header icons with dark-mode inversion

1. Layout

Class Role
portal-grid portal-grid--2 2 equal columns, collapsing cleanly to 1 column below 340px per column.
portal-grid portal-grid--3 3 equal columns on desktop, collapsing to 1 column below 960px.
portal-grid portal-grid--4 4 equal columns on desktop, stepping cleanly to 2×2 below 1120px and 1 column below 550px.
portal-grid portal-grid--auto Fluid auto-fit grid for 2 or 3 borderless columns.
portal-grid portal-grid--feature Weighted 2-column spotlight layout at 1.45fr / 1fr, collapsing below 960px.
portal-grid--divided Optional modifier adding a subtle top divider above any grid.
portal-stack Vertical stack of cards inside one grid column, stretching the last card to align bottom edges.
portal-split Nested 2-column grid inside a single card body.

2. Page headers

Class Role
portal-intro Soft green editorial hero box with optional left logo (portal-intro__logo), text wrapper (portal-intro__body), lead line (portal-intro__lead), muted subtext (portal-intro__sub), and optional quick-link strip (portal-intro__links).
portal-bar Slim single-row utility strip for directory hubs, pairing a left description (portal-bar__text) with a right-aligned routing hint (portal-bar__meta).

3. Containers

Class Role
portal-door Tier 1 focal entry: clickable round icon badge (portal-door__badge), bold title (portal-door__title), and short description (portal-door__desc). Centered in 3-column desktop grids, flipping to horizontal rows below 960px. Add portal-door--row for an always-horizontal icon-left layout in 2-column focal rows.
portal-pillar Unified doorway pillar pairing a portal-door with a compact shortcut list (portal-pillar__links) inside portal-grid--4. Renders 4-across with a hairline divider on desktop, flipping to icon-left 2×2 below 1120px and a single divided stack below 550px.
portal-card Tier 2 structured card with OSM green accent, flex-column by default so footers always align. Parts: portal-card__head, optional right-aligned portal-card__actions, portal-card__body (add portal-card__body--plain for bulletless lists), and optional portal-card__footer. Tone modifiers: portal-card--featured (2px green border) and portal-card--neutral (Codex neutral grey).
portal-col Tier 3 quiet borderless column with underlined heading (portal-col__head) and optional portal-col--plain modifier for bulletless lists.

4. Notes & alerts

Class Role
portal-note Left-accented green info or tip box (with optional portal-note__head for block notes).
portal-note portal-note--warn Codex amber warning or outage notice.
portal-note portal-note--neutral Codex subtle grey aside.

5. Helpers & widgets

Class Role
portal-muted Secondary muted text using Codex --color-subtle.
portal-subhead / portal-subhead-row / portal-subhead-link Internal card subsection heading and optional right-aligned link.
portal-divider Subtle horizontal divider inside a card body.
portal-jumpbar / portal-jumpbox / portal-jumpbox--primary Responsive in-page section jump grid (full-width primary strip + 4 → 2×2 → 1 columns) for long guides.
portal-gallery / portal-gallery__item / portal-gallery__caption Responsive 5-image showcase strip stepping 5 → 2+3 → 1.
portal-feed Styled feed table for {{News|bare=yes}} (uses portal-feed__year and hides portal-feed__legacy-footer). Also styles <osmcal> event tables inside portal-card__body.
portal-tree / portal-tree--cap-6 Styled #categorytree list with empty-state fallback and optional 6-item display cap.

Quick example

{{Portal styles}}

<div class="portal-intro">
<div class="portal-intro__body">
<p class="portal-intro__lead">'''Page lead''' summarizing the topic in one clear sentence.</p>
<p class="portal-intro__sub">Supporting context or secondary routing links.</p>
</div>
</div>

<div class="portal-grid portal-grid--2">
<div class="portal-card">
<div class="portal-card__head" role="heading" aria-level="2">Primary card</div>
<div class="portal-card__body">
* '''[[Map features]]''': <span class="portal-muted">common keys and values</span>
</div>
<div class="portal-card__footer">'''[[Contributor hub]]'''</div>
</div>

<div class="portal-card portal-card--neutral">
<div class="portal-card__head" role="heading" aria-level="2">Secondary card</div>
<div class="portal-card__body">
* '''[[Get help]]''': <span class="portal-muted">forums, chat, and guides</span>
</div>
</div>
</div>