Table of Contents

§ 1.1 Base Type

For our base we use the following font settings on the HTML element to standardize the typographic scale in a consistent manner. We also make sure not to use united values for our line-heights per the recommendations of Mr. Eric Meyer himself.

_typeplate.scss
// $Variable $BaseType
// -------------------------------------//

//the serif boolean var can be redeclared from another stylesheet. However
//the var must be placed after your @import "typeplate.scss";
$serif-boolean: true !default;

$font-family: if($serif-boolean, serif, sans-serif) !default; // Non-font-face font-stack

$font-weight: normal !default;
$line-height: 1.65 !default;
$font-size: 112.5 !default; // percentage value (16 * 112.5% = 18px)
$font-base: 16 * ($font-size/100) !default; // converts our percentage to a pixel value
$custom-font-family: false !default; // Custom font-face stack, if set will be added to the $font-family


// $Styles $Globals
// -------------------------------------//

html {
	@if $custom-font-family {
		font: $font-weight #{$font-size}%/#{$line-height} $custom-font-family, $font-family;
	} @else {
		font: $font-weight #{$font-size}%/#{$line-height} $font-family;
	}
}
↑ back to top

§ 1.2 Typographic Scale

Establish clearly distinguishable heading levels with font-size. Don’t randomly pick font sizes, choose a type hierarchy that is harmonious and consistent. Do your best to use a modular scale that calculates those sizes from a ratio ensuring your design and typography can relate in a meaningful way. There’s an excellent calculator for this at modularscale.com.

By using culturally relevant, historically pleasing ratios to create modular scales and basing the measurements in our compositions on values from those scales, we can achieve a visual harmony not found in layouts that use arbitrary, conventional, or easily divisible numbers.

Tim Brown

Heading Giga

Heading Mega

Heading Alpha

Heading Beta

Heading Gamma

Heading Delta

Heading Epsilon

Heading Zeta

HTML
<!--
Custom header classes. These classes can be used on various elements
of your choosing. Classes depicted below are strictly for example
purposes and not a requirement.

If you'd like to manipulate the size of other typographic elements,
feel free to include the Sass '@extend' with your selector.
For example…

p {
	@extend .alpha;
}
-->
<h1 class="giga">Heading Giga</h1>
<h1 class="mega">Heading Mega</h1>
<h1 class="alpha">Heading Alpha</h1>
<h2 class="beta">Heading Beta</h2>
<h3 class="gamma">Heading Gamma</h3>
<h4 class="delta">Heading Delta</h4>
<h5 class="epsilon">Heading Epsilon</h5>
<h6 class="zeta">Heading Zeta</h6>
_typeplate.scss
$measure: $font-base * $line-height;

// Modular Scale Values
// http://typecast.com/blog/contrast-through-scale
$tera: 117 !default; // 117 = 18 × 6.5
$giga: 90 !default; // 90 = 18 × 5
$mega: 72 !default; // 72 = 18 × 4
$alpha: 60 !default; // 60 = 18 × 3.3333
$beta: 48 !default; // 48 = 18 × 2.6667
$gamma: 36 !default; // 36 = 18 × 2
$delta: 24 !default; // 24 = 18 × 1.3333
$epsilon: 21 !default; // 21 = 18 × 1.1667
$zeta: 18 !default; // 18 = 18 × 1

// typscale unit
$type-scale-unit-value: rem !default;

// $Function $Context Calculator
// -------------------------------------//
// divide a given font-size by base font-size & return a relative value

@function context-calc($scale, $base, $value) {
	@return ($scale/$base)#{$value};
}

// $Function $Measure-Margin
// -------------------------------------//
// divide 1 unit of measure by given font-size & return a relative em value

@function measure-margin($scale, $measure, $value) {
	@return ($measure/$scale)#{$value};
}

// $Mixin $Type-Scale
// -------------------------------------//

@mixin type-scale($scale, $base, $value, $measure:"") {

	@if $value == rem {
		font-size: $scale#{px};
	}

	font-size: context-calc($scale, $base, $value);

	@if $measure != "" {

		@if $value == rem {
			margin-bottom: measure-margin($scale, $measure, $value: px);
		}

		margin-bottom: measure-margin($scale, $measure, $value);
	}
}

// Extend included classes on any element of your
// choosing for adjusting type based on the scale
// provided.
// Special Props to Harry Roberts for this trick.

// For example:

// <h6 class="giga">Awesome Headline</h6>
// <p class="tera">a story about a dude</p>

// Our Type Scale is as follows with px fallbacks
// for IE 6-8 as they do not understand REM units.
//
// 18, 21, 24, 36, 48, 60, 72, 90, 117

// styles for all headings, in the style of @csswizardry
%hN {
	text-rendering: optimizeLegibility; // voodoo to enable ligatures and kerning
	line-height: 1; // this fixes huge spaces when a heading wraps onto two lines
	margin-top: 0;
}

// Multi-dimensional array, where:
// the first value is the name of the class
// and the second value is the variable for the size
$sizes: tera $tera, giga $giga, mega $mega, alpha $alpha, beta $beta, gamma $gamma, delta $delta, epsilon $epsilon, zeta $zeta;

// Sass loop to associate h1-h6 tags with their appropriate greek
// heading based on a modular scale.
// for each size in the scale, create a class
@each $size in $sizes {
	.#{nth($size, 1)} {
		@include type-scale(nth($size, 2), $font-base, '#{$type-scale-unit-value}', $measure);
	}
}

// associate h1-h6 tags with their appropriate greek heading
h1 {
	@extend .alpha;
	@extend %hN;
}

h2 {
	@extend .beta;
	@extend %hN;
}

h3 {
	@extend .gamma;
	@extend %hN;
}

h4 {
	@extend .delta;
	@extend %hN;
}

h5 {
	@extend .epsilon;
	@extend %hN;
}

h6 {
	@extend .zeta;
	@extend %hN;
}
↑ back to top

§ 1.3 Color

Just like in print, don’t use the darkest black available in your body text (#000). Instead, go for something softer, like #444. You can use a slightly darker color for titles like (#222) for example. Since these values are considered a de facto standard in practice, they're not necessarily ordained by law.

_typeplate.scss
$body-copy-color: #444 !default;
$heading-color: #222 !default;

body {
	color: $body-copy-color;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	color: $heading-color;
}
↑ back to top

§ 1.4 Word-Wrap

The word-wrap CSS property is used to specify whether or not the browser may break lines within words in order to prevent overflow when an otherwise unbreakable string is too long to fit in its containing box.

Example:

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio iste voluptates saepe ipsa magni repellendus explicabo numquam expedita dolore eveniet accusantium iure sit consequatur? Dolore minus vel blanditiis velit deserunt! We’ll also be checking a few things like the longest word in the world “Methionylthreonylthreonylglutaminylarginylisoleucine” and other stuff like links that are way long such as “Methionylthreonylthreonylglutaminylarginylisoleucine” and other long links like http://192.168.1.100/somedirectory/stayout/of/my/shit

_typeplate.scss
// Silent Sass Classes - A.K.A Placeholders
//
// normal: Indicates that lines may only break at normal word break points.
// break-word : Indicates that normally unbreakable words may be broken at
// arbitrary points if there are no otherwise acceptable break points in the line.

%breakword {
	word-wrap: break-word;
}

%normal-wrap {
	word-wrap: normal;
}

%auto-wrap {
	word-wrap: auto;
}

body {
	@extend %breakword;
}
↑ back to top

§ 2.1 Indenting

On the web, paragraphs are commonly set in blocks, with top and bottom margins. Historically, paragraphs are set using indentation, which makes it easier to scan long-form text and are (we think) more conducive to readability.

For the curious, here's a few example sites using the paragraph indentation approach we've chosen for our starter kit…Mark Boulton, Nice Web Type, Andy Rutledge and Nathan Ford just to name a few.

Authors choosing to opt out of our default styling may feel free to change the boolean variable in the Sass port to remove this opinionated default as depicted in the example below. CSS people you'll have to settle for the manual route to customize.

I crawled out almost immediately, and crouched, my feet still in the water, under a clump of furze. The horse lay motionless (his neck was broken, poor brute!) and by the lightning flashes I saw the black bulk of the overturned dog cart and the silhouette of the wheel still spinning slowly. In another moment the colossal mechanism went striding by me, and passed uphill towards Pyrford.

Seen nearer, the Thing was incredibly strange, for it was no mere insensate machine driving on its way. Machine it was, with a ringing metallic pace, and long, flexible, glittering tentacles (one of which gripped a young pine tree) swinging and rattling about its strange body.

It picked its road as it went striding along, and the brazen hood that surmounted it moved to and fro with the inevitable suggestion of a head looking about. Behind the main body was a huge mass of white metal like a gigantic fisherman’s basket, and puffs of green smoke squirted out from the joints of the limbs as the monster swept by me. And in an instant it was gone.

So much I saw then, all vaguely for the flickering of the lightning, in blinding highlights and dense black shadows.

As it passed it set up an exultant deafening howl that drowned the thunder—“Aloo! Aloo!”—and in another minute it was with its companion, half a mile away, stooping over something in the field. I have no doubt this Thing in the field was the third of the ten cylinders they had fired at us from Mars.

_typeplate.scss
// Text Indentation Value
$indent-val: 1.5em !default;

// Paragraph Styling Boolean
// 'false' means no vertical whitespace
// between subsequent paragraphs.
$paragraph-vertical-whitespace: false !default;

p {
	margin: auto auto $indent-val;

	// Conditonal Check For Paragraph Styling
	@if $paragraph-vertical-whitespace == false {
		& + p {
			//siblings indentation
			text-indent: $indent-val;
			margin-top: -$indent-val;
		}
	}
}
↑ back to top

§ 2.2 Hyphenation

Responsive or not, there’s no reason why we shouldn’t all be designing and building sites on flexible foundations. In a fluid layout, browser width and typographic measure are linked: the wider the viewport, the more characters per line. Keeping in mind that a range of 45-75 characters per line is generally accepted as safe for comfortable reading, there are a few things that can be done to avoid extra long lines of text in fluid layouts. Robert Bringhurst recommends for us to leave at least two characters behind and take at least three forward.

Since hyphens is an inherited property, it isn’t sufficient to set it for a limited number of elements and assume you’re done. You have to make sure you’ve turned it off for the elements that shouldn’t be hyphenated.

Eric Meyer
_typeplate.scss
@mixin css-hyphens($val) {
	// Accepted values: [ none | manual | auto ]
	-webkit-hyphens: $val; // Safari 5.1 thru 6, iOS 4.2 thru 6
	-moz-hyphens: $val; // Firefox 16 thru 20
	-ms-hyphens: $val; // IE10
	-o-hyphens: $val; // PRESTO...haha LOL
	hyphens: $val; // W3C standard
}

body {
	// Ala Trent Walton
	// http://trentwalton.com/2011/09/07/css-hyphenation
	@include css-hyphens(auto);
}

abbr,
acronym,
blockquote,
code,
dir,
kbd,
listing,
plaintext,
q,
samp,
tt,
var,
xmp {
	// http://meyerweb.com/eric/thoughts/2012/12/17/where-to-avoid-css-hyphenation
	@include css-hyphens(none);
}
↑ back to top

§ 3.1 Small Capitals

Small caps help to make abbreviations way easier to read but won’t stand out from the text. We highly suggest this bit of typographic flare with your content. True small capitals are now possible on the web, but alas they are still a bitch and will also depend on the type face in use. Definitely check out Open Typography for those typefaces and services that provide authentic small caps.

Lorem ipsum dolor sit amet, consectetur HTML adipisicing elit. CSS Laboriosam voluptatem a beatae accusantium accusamus dolor provident error consectetur quibusdam suscipit neque temporibus. Velit omnis voluptatum quasi tempora reiciendis expedita reprehenderit.

HTML
<abbr title="hyper text markup language">HTML</abbr>
_typeplate.scss
$small-caps-color: gray !default;
$small-caps-weight: 600 !default;

@mixin smallcaps($color, $font-weight) {
	// depends on the font family.
	// some font-families don’t support small caps
	// or don’t provide them with their web font.
	font-variant: small-caps;
	font-weight: $font-weight;
	text-transform: lowercase;
	color: $color;
}

abbr {
	@include smallcaps($small-caps-color, $small-caps-weight);
	&:hover {
		cursor: help;
	}
}
↑ back to top

§ 3.2 Drop Capitals

A Drop Cap is the art of using an uppercase glyph to mark the start of copy. A technique that has been around for almost two thousand years!

There now is your insular city of the Manhattoes, belted round by wharves as Indian isles by coral reefs—commerce surrounds it with her surf. Right and left, the streets take you waterward. Its extreme downtown is the battery, where that noble mole is washed by waves, and cooled by breezes, which a few hours previous were out of sight of land. Look at the crowds of water-gazers there.

HTML
<!-- Add the drop-cap class to your element -->
<p class="drop-cap">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Unde in aliquid rem. Esse laboriosam nisi quas eveniet atque consequatur perferendis nostrum dignissimos magni cum suscipit delectus nam placeat qui rem.</p>
_typeplate.scss
$dropcap-float-position: left !default;
$dropcap-font-size: 4em !default;
$dropcap-font-family: inherit !default;
$dropcap-txt-indent: 0 !default;
$dropcap-margin: inherit !default;
$dropcap-padding: inherit !default;
$dropcap-color: inherit !default;
$dropcap-line-height: 1 !default;
$dropcap-bg: transparent !default;

// Use @include dropcap($dropcap-float-position, $dropcap-font-size, $dropcap-font-family, $dropcap-txt-indent, $dropcap-margin, $dropcap-padding, $dropcap-color, $dropcap-line-height, $dropcap-bg);
// to pass the following arguments below. Feel free to pass in custom
// values for the variables we've provided.
//
// Make sure you add the class “drop-cap” to your markup in order to operate.
@mixin dropcap($dropcap-float-position, $dropcap-font-size, $dropcap-font-family, $dropcap-txt-indent, $dropcap-margin, $dropcap-padding, $dropcap-color, $dropcap-line-height, $dropcap-bg) {
	&:first-letter {
		float: $dropcap-float-position;
		margin: $dropcap-margin;
		padding: $dropcap-padding;
		font-size: $dropcap-font-size;
		font-family: $dropcap-font-family;
		line-height: $dropcap-line-height;
		text-indent: $dropcap-txt-indent;
		background: $dropcap-bg;
		color: $dropcap-color;
	}
}

// Combats our sibling paragraphs syling and indentation
// As not to ruin our beautiful drop caps.
p + .drop-cap {
	text-indent: 0;
	margin-top: 0;
}

.drop-cap {
	@include dropcap($dropcap-float-position, $dropcap-font-size, $dropcap-font-family, $dropcap-txt-indent, $dropcap-margin, $dropcap-padding, $dropcap-color, $dropcap-line-height, $dropcap-bg);
}
↑ back to top

§ 3.3 Unicode Ampersands

With the unicode-range property we can avoid using verbose markup and only target the characters we like according to the unicode unique identifier. We also harness the power of the %placeholder in Sass allowing like minded selectors to string together this shared property in a DRY way from one single declaration. Copy and paste the Sass below into Codepen and check out the output for yourself. Hint: create multiple classes.

Amper & Sands

_typeplate.scss
//Unicode Ampersand @font-face
$amp-fontface-name: Ampersand !default;
$amp-fontface-source: local('Georgia'), local('Garamond'), local('Palatino'), local('Book Antiqua') !default;
$amp-fontface-fallback: local('Georgia') !default;

// Allows for our ampersand element to have differing
// font-family from the ampersand unicode font-family.
$amp-font-family: Verdana, sans-serif !default;

@font-face {
	font-family: '#{$amp-fontface-name}';
	src: $amp-fontface-source;
	unicode-range: U+0026;
}

// Ampersand fallback font for unicode range
@font-face {
	font-family: '#{$amp-fontface-name}';
	src: $amp-fontface-fallback;
	unicode-range: U+270C;
}

@mixin ampersand($amp-font-family...) {
	font-family: $amp-font-family;
}

%ampersand-placeholder {
	@include ampersand($amp-fontface-name, $amp-font-family);
}

// Call your ampersand on any element you wish from another stylesheet
// using this Sass extend we've provided. For exmaple:
//
// <h6 class="ampersand">Dewey Cheat 'em & Howe</h6>
//
// .ampersand { @extend %ampersand-placeholder; }
↑ back to top

§ 4.5 Icon Font Helper

The Icon Font Helper is a special tool for those that use custom icon fonts, but don't wanna change all the reference links for the font files –especially the multitude of file types required (EOT, TTF, SVG, & WOFF). With so many URIs and file types it can become extremely tedious. By taking advantage of the Icon Font Helper authors can write in one line using a Sass loop and Compass' @include font-face helper function. This setup requires a bit of configuration on an authors part depending on specific project needs and workflows.

_typeplate-vars.scss
//custom variable to override default value
$icon-fonts: (icon-font-name, another-icon-font-name);
_typeplate.scss
// ICON FONTS HELPER
// In order to set you must have the following…
// 1. Compass
// 2. Create a 'fonts' directory in the root of your project
// 3. Specify within your 'config.rb' file the following line…
//
// fonts_dir = "name-of-your-fonts-directory" ( i.e. fonts_dir = "fonts" )
//
// Example usage
// ex.1) $icon-fonts: (icon-name);
// ex.2) $icon-fonts: (icon-name1, icon-name2, icon-name3);
$icon-fonts: null !default;

// @include font-face() is a compass function so it will require compass
// based on this gist by Chris Van Patten
// https://gist.github.com/4469518
@if ($icon-fonts != null) {
	@each $font in $icon-fonts {
		@include font-face( $font,
			font-files(
				'#{$font}/#{$font}.woff',
				'#{$font}/#{$font}.ttf',
				'#{$font}/#{$font}.svg', svg
			),
			'#{$font}/#{$font}.eot'
			)
	}
}
CSS Output
@font-face {
	font-family: "icon-font-name";
	src: url('//fonts/icon-font-name/icon-font-name.eot');
	src: url('//fonts/icon-font-name/icon-font-name.eot?#iefix') format('eot'), url('//fonts/icon-font-name/icon-font-name.woff') format('woff'), url('//fonts/icon-font-name/icon-font-name.ttf') format('truetype'), url('//fonts/icon-font-name/icon-font-name.svg') format('svg');
}

@font-face {
	font-family: "another-icon-font-name";
	src: url('//fonts/another-icon-font-name/another-icon-font-name.eot');
	src: url('//fonts/another-icon-font-name/another-icon-font-name.eot?#iefix') format('eot'), url('//fonts/another-icon-font-name/another-icon-font-name.woff') format('woff'), url('//fonts/another-icon-font-name/another-icon-font-name.ttf') format('truetype'), url('//fonts/another-icon-font-name/another-icon-font-name.svg') format('sag');
}
↑ back to top

§ 3.4 Small Print

The small element is used to represent side comments or what’s commonly referred to as ‘small print’: disclaimers, caveats, legal restrictions, or copyrights. It can also be used for attributions or satisfying licensing requirements.

small is now for side comments, which are the inline equivalent of aside—content which is not the main focus of the page. A common example is inline legalese, such as a copyright statement in a page footer, a disclaimer, or licensing information. It can also be used for attribution. Don’t use it for block-level content (paragraphs, lists, etc.), as this would be considered main content.

small text does not need to be smaller than surrounding text — if all you want is smaller text use CSS instead. Use small only on inline content.

Oli Studholme

Buy one widget, get one free! (While supplies last. Offer expires on the vernal equinox. Not valid in Ohio.)

HTML
<small>(While supplies last. Offer expires on the vernal equinox. Not valid in Ohio.)</small>
_typeplate.scss
$small-print-size: 65% !default;

small {
	font-size: $small-print-size;
}
↑ back to top

§ 4.1 Code Blocks

Monospace fonts just as you desire for all your code block dreams! Monospace fonts or “fixed pitch” fonts, contain characters that all have the same character width. ‘l’, ‘1’ and ‘i’ are easily distinguished with monospace, ‘0’, ‘o’ and ‘O’ are easily distinguished and clear punctuation characters, especially braces, parenthesis and brackets.

HTML
 /* Code Block Example within Markup */
h1 {
	background: red;
	color: blue;
	padding: 1em;
	margin: 3em;
	border: 2px solid black;
}
_typeplate.scss
@mixin white-space($wrap-space) {
	@if $wrap-space == 'pre-wrap' {
		white-space: #{-moz-}$wrap-space; // Firefox 1.0-2.0
		white-space: $wrap-space;       // current browsers
	} @else {
		white-space: $wrap-space;
	}
}

pre code {
	@extend %normal-wrap;
	@include white-space(pre-wrap);
}

pre {
	@include white-space(pre);
}

code {
	@include white-space(pre);
	font-family: monospace;
}
↑ back to top

§ 4.2 Figures

Fig. 4.2 | Type Anatomy, a diagram and anatomy of typography.
HTML
<figure>
	<figcaption>
		<strong>Fig. 4.2 | </strong>Type Anatomy, an excerpt from Mark Boulton's book<cite title="http://designingfortheweb.co.uk/book/part3/part3_chapter11.php">“Designing for the Web”</cite>
	</figcaption>
</figure>
↑ back to top

§ 4.3 Block Quotes

The blockquote element represents a section that is being quoted from another source. Good blockquotes should include a citation, but one is not required. Stylistically, these can look a lot like pull-quotes by using :before and :after pseudo elements for the curly quotes, or, authors can include them inline.

The contents of blockquote are limited to headings and paragraphs. header, footer, or cite tags are not allowed. For more examples, see A List Apart's sample blockquote patterns.

Embracing the fluid & flexible aspect of responsive web design was an easy decision, but I’ve been less sure-footed when it comes to balancing that with setting type on the web

Trent Walton
HTML
<figure>
	<blockquote cite="">
		<p></p>
	</blockquote>
	<figcaption>
		<cite>
			<small><a href=""></a></small>
		</cite>
	</figcaption>
</figure>
_typeplate.scss
$cite-display: block !default;
$cite-text-align: right !default;
$cite-font-size: inherit !default;

// Use our pre-defined markup and add a class
// to your custom blockquote element.
// For example:
//
// .blockquote { @include blockquote("-"); }
//
// "-" is your citation flourish. For example:
//
// I always say important things because I'm so smart
//                                      - author name

// Citation Mixin for Custom Styling
@mixin cite-style($display, $text-align, $font-size) {
	display: $display;
	font-size: $font-size;
	text-align: $text-align;
}

%cite {
	@include cite-style($cite-display, $cite-text-align, $cite-font-size);
}

@mixin blockquote($citation-flourish) {
	p {
		&:last-of-type {
			margin-bottom: -#{$line-height/2}em;
		}
	}
	+ figcaption {
		@extend %cite;
		&:before {
			content: $citation-flourish;
		}
	}
}
↑ back to top

§ 4.4 Pull Quotes

Pull quotes are tricky, but with this little ditty they’re not so difficult or tedious anymore. The example is an improvement based upon the 24 ways article discussing swooshy curly quotes without images. This particular example depicted takes advantage of psuedo selectors and the <aside> tag.

HTML
<aside class="pull–quote">
	<blockquote>
		<p></p>
	</blockquote>
</aside>
_typeplate.scss
$pull-quote-fontsize: 4em !default;
$pull-quote-opacity: 0.5 !default;
$pull-quote-color: #dc976e !default;


// $Mixin $Pull Quotes
// -------------------------------------//

@mixin pull-quotes($pull-quote-fontsize, $pull-quote-opacity, $pull-quote-color) {
	position: relative;
	padding: context-calc($pull-quote-fontsize, $pull-quote-fontsize, em);
	&:before,
	&:after {
		height: context-calc($pull-quote-fontsize, $pull-quote-fontsize, em);
		opacity: $pull-quote-opacity;
		position: absolute;
		font-size: $pull-quote-fontsize;
		color: $pull-quote-color;
	}
	&:before {
		content: '“';
		top:  0;
		left: 0;
	}
	&:after {
		content: '”';
		bottom: 0;
		right: 0;
	}
}

// use this include on your pull quote selector class
.pull-quote {
	@include pull-quotes;
}
↑ back to top

§ 4.7 Footnotes

The sites we’ve built to display on a desktop, smartphone, or a tablet today could be on a TV Screen, coffee table display, or mega space yacht projection system tomorrow. Do yourself a favor and heed the advice of the Dao: A fully-scalable web1

  1. Style sheets that use relative units can more easily scale from one output environment to another. Most of the time I use em and rem.
HTML
<!-- Footnote Markup : Replace ‘X” with your unique number for each footnote -->
<article>
	<p><sup><a href="#fn-itemX" id="fn-returnX"></a></sup></p>
	<footer>
		<ol class="foot-notes">
			<li id="fn-itemX"><a href="#fn-returnX">↩</a></li>
		</ol>
	</footer>
</article>
↑ back to top

§ 4.8 Definition Lists

The dl element is for another type of list called a definition list. Instead of list items, the content of a dl consists of dt (Definition Term) and dd (Definition Description) pairs.

TypePlate offers several different patterns for definition lists. In all three of the examples below, the contents of dts are wrapped in b tags, and a class of .micro is given to the contents of dds. First is the default format for definitions lists.

a) Multi-line Definitions (default)

This is a term
this is the definition of that term, which both live in a dl.
Another Term
And it gets a definition too, which is this line
This is a 2nd definition for a single term. A dt may be followed by multiple dds.
HTML
<dl>
	<dt><b></b></dt>
	<dd></dd>
</dl>

b) Inline Definitions

The second format for definition lists is lining. This style is more robust, with support for multiple terms defined by a single definition, and applies proper punctuation (: ,) where appropriate:

This is a term
this is the definition of that term, which both live in a dl.
Another Term
And it gets a definition too, which is this line
this is a 2nd definition for a single term.
Term
Other Defined Term
dt terms may stand on their own without an accompanying dd, but in that case they share descriptions with the next available dt. You may not have a dd without a parent dt.
HTML
<dl class="lining">
	<dt><b></b></dt>
	<dd></dd>
</dl>
_typeplate.scss
@mixin definition-list-style($style) {
	// lining style
	@if $style == lining {
		dt, dd {
			display: inline;
			margin: 0;
		}
		dt, dd {
			& + dt {
				&:before {
					content: "\A";
					white-space: pre;
				}
			}
		}
		dd {
			& + dd {
				&:before {
					content: ", ";
				}
			}
			&:before {
					content: ": ";
					margin-left: -0.2rem; // removes extra space between the dt and the colon
			}
		}
	}
}

dl {
		@include definition-list-style(lining);
}

c) Dictionary-style Definition

The third format for definition lists is dictionary. This style is more a formal, applying proper punctuation where necessary and includes ordinal indicators:

This is a term
this is the definition of that term, which both live in a dl.
Another Term
And it gets a definition too, which is this line
this is a 2nd definition for a single term.
Term
Other Defined Term
dt terms may stand on their own without an accompanying dd, but in that case they share descriptions with the next available dt. You may not have a dd without a parent dt.
HTML
<dl class="dictionary-style">
	<dt><b></b></dt>
		<dd></dd>
	<dt><b></b></dt>
		<dd></dd>
		<dd></dd>
	<dt><b></b></dt>
		<dd></dd>
</dl>
_typeplate.scss
@mixin definition-list-style($style) {
	// dictionary-style
	@if $style == dictionary-style {
		dt {
			display: inline;
			counter-reset: definitions;
			& + dt {
				&:before {
					content: ", ";
					margin-left: -0.2rem; /* removes extra space between the dt and the comma */
				}
			}
		}
		dd {
			display: block;
			counter-increment: definitions;
			&:before {
				content: counter(definitions, decimal) ". ";
			}
		}
	}
}

dl {
	@include definition-list-style(dictionary-style);
}
↑ back to top