Prose
Long-form content: paragraphs, headings, lists, quotes, rules and code. The
classless build styles these elements everywhere. The class build scopes them
to .prose, so a paragraph inside a component keeps its own spacing.
| Class | Does what |
|---|---|
prose | Styles p, h1 to h6, ul, ol, li, blockquote, hr, code, pre, samp and kbd inside it |
kbd | Key cap, usable outside .prose |
Headings and paragraphs
<div class="prose">
<h1>Heading one</h1>
<h2>Heading two</h2>
<h3>Heading three</h3>
<p>Body text sits at 16px with a 1rem bottom margin.</p>
</div>
<div>
<h1>Heading one</h1>
<h2>Heading two</h2>
<h3>Heading three</h3>
<p>Body text sits at 16px with a 1rem bottom margin.</p>
</div>
Lists, quotes and rules
<div class="prose">
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
<blockquote>A quote gets a thick left border in the theme color.</blockquote>
<hr />
<ol>
<li>Ordered one</li>
<li>Ordered two</li>
</ol>
</div>
<div>
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
<blockquote>A quote gets a thick left border in the theme color.</blockquote>
<hr />
<ol>
<li>Ordered one</li>
<li>Ordered two</li>
</ol>
</div>
Code
<div class="prose">
<p>Inline <code>code</code> and <samp>samp</samp> sit on a raised surface.</p>
<pre><code>const theme = "@sparkstone/css";
console.log(theme);</code></pre>
</div>
<div>
<p>Inline <code>code</code> and <samp>samp</samp> sit on a raised surface.</p>
<pre><code>const theme = "@sparkstone/css";
console.log(theme);</code></pre>
</div>
Composition
Common ways to put this together with other components. The general rules are on Composition.
Article page
A long-form page: a heading, a one-line summary under it, body copy with a pull quote, and a closing call to action. One .prose on the article spaces all of it.
<article class="prose" style="max-width: 80ch">
<h1>How we rebuilt the booking flow</h1>
<p class="text-secondary">Three weeks, one form, and half the drop-off.</p>
<p>The old flow asked for everything up front. Most people left at the second screen.</p>
<blockquote>We stopped asking for anything we could find out later.</blockquote>
<h2>What changed</h2>
<ul>
<li>One screen instead of four</li>
<li>Optional fields moved after the booking</li>
</ul>
<h2>Have a form like this?</h2>
<p>A short call is the quickest way to find out what to cut.</p>
<a href="#" class="btn">Book a call</a>
</article>
- Text: the summary is
.text-secondary, so it reads as a lead-in rather than a second heading. - Actions: the button is the only filled thing on the page, at the end, where a reader who finished is ready to act.
Text beside an image
A photo or illustration beside a heading, a paragraph and a link. On a phone the image goes above.
<section class="flex flip" style="align-items: center">
<div style="width: 12rem; flex-shrink: 0; aspect-ratio: 1; border-radius: var(--border-radius); background: var(--fill-strong)" role="img" aria-label="Portrait"></div>
<div class="prose" style="flex: 1">
<h2>About the studio</h2>
<p>One person, building and looking after the software small businesses run on.</p>
<a href="#" class="link">More about the studio</a>
</div>
</section>
- Text:
.prosesits on the text column, not the row, so the image gets no margins. - Layout: the image takes a
widthandflex-shrink: 0rather than a flex basis. Under.flipthe row becomes a column on a phone, and a basis would turn into a height.
Above a page heading
The trail sits directly above the heading of the page it ends at.
<nav class="breadcrumbs" aria-label="Breadcrumbs">
<ol>
<li><a href="#" class="link">Home</a> <span class="breadcrumbs-separator" aria-hidden="true">/</span></li>
<li><a href="#" class="link">Catalog</a> <span class="breadcrumbs-separator" aria-hidden="true">/</span></li>
<li><span aria-current="page">Item name</span></li>
</ol>
</nav>
<div class="prose">
<h1>Item name</h1>
<p class="text-secondary">A line about the item.</p>
</div>
- Text: the current page is plain text with
aria-current; it matches the heading below, so the trail and the page agree.