Below is most everything we’ll need to style our theme (check the source code to see all the embedded elements).
Heading 2
We’ll start with headings, levels 1–6. Articles have only one H1, the title above. This heading is H2. H2s and H3s are group paragraphs into sections. Usually, the spacing above the heading is greater than it is below, so the heading is closer to its section.
Heading 3
HTML standards require an H2 be followed only by an H3 or another H2 — don’t skip a level. This gives the document proper outline structure (and a11y).
Heading 4
Heading-level 4-6 are rarely used.
Heading 5
Heading 6
Text styles
This text has strong emphasis compared to this with regular emphasis. Emphasis can be different than bold and italic text, or a cite, as in A Magazine Name.
Let’s not forget to style subscripts, like H2O, and the superscripts in E = MC2 or an endnote.1
We should check that an abbreviation, like HTML, has styling (maybe with a “?” cursor on hover). We may want to define what code looks like <var>with a variable</var>
. We may use one style for deleted text and another for insertions. And here’s some big text next to some text in a small tag.
We should determine the characters-per-line of our paragraphs: a CPL of 50-90 is considered optimum. It’s wise to decide on the spacing between lines, usually a 1.25–1.5 multiple of font-size.
The above are two-line paragraph breaks.
This is after a single line break. And below is a heading rule.
List types
Unordered list
- List items are usually indented.
- And start a list-style character, like a disc.
- Nested lists are often further indented.
- With a different list-style, like an open circle.
- And here’s a second-level of nested list.
- With a different list-style, like a square.
- Decide on the vertical spacing between list items.
- Check vertical spacing between list items.
- And check vertical spacing between nested lists.
Ordered list
- The ordered list might also be indented.
- And have a number as its list-style.
- With more indention for a nested list.
- And a different numbering style (e.g., letters or roman).
- We’ll likely never need a deeper nested ordered list.
- But if we ever do, it should have some style.
- Again, specify margins and spacings.
Definition list
The definition list has a term then its description, which is often indented under the other or side by side with the term emphasized.- Definition List Title
- This is a definition list division.
- Definition
- An exact statement or description of the nature, scope, or meaning of something: our definition of what constitutes poetry.
Blockquotes
Take care to style our quote blocks differently than regular body text. Common choices are margins and a different font:Good afternoon, gentlemen. I am a HAL 9000 computer. I became operational at the H.A.L. plant in Urbana, Illinois on the 12th of January 1992. My instructor was Mr. Langley, and he taught me to sing a song. If you’d like to hear it I can sing it for you. — HAL 9000Note this quote’s last line is within a
<cite>
tag, indicating the quote’s attribution — again, often styled differently that the quote itself.
Links (and their states)
A great reference making styling decisions is Practical Typography. Link-test is are best identified in at least two ways (for accessibility). Browsers underline link-text and color it blue, then purple once a link has been visited (this link cannot be visited so stays the same). Mouseover a link to see its hover styles (if any); click/touch it to see it active. All the states of a link can be styled: default, visited, hover, and active.Tables
Tables w/ “tabular” class
Tables by default have a 100% width, left text-align, and bold column headings, but no other styling. For a more advanced table, with zebra odd/even coloring, row mouseover effects, and blue heading row, addclass="tabular"
, and the table displays like this:
Crude Oil (2009) | Dry Natural Gas (2009) | Natural Gas Liquids (2008) | ||||
---|---|---|---|---|---|---|
Volume, Million Barrels | Share of National Total | Volume, Billion Cubic Feet | Share of National total | Volume, Million Barrels | Share of National Total | |
U.S. | 20,682 | 272,509 | 9,275 | |||
Colorado | 279 | 1.4% | 23,058 | 8.5% | 716 | 7.7% |
Montana | 343 | 1.6% | 976 | <.01% | 11 | <.01% |
New Mexico | 700 | 3.3% | 15,598 | 5.7% | 804 | 8.7% |
North Dakota | 1,046 | 5% | 1,079 | <.01% | 55 | <.01% |
Utah | 398 | 2% | 7,257 | 2.7% | 116 | 1.3% |
Wyoming | 583 | 2.6% | 35,283 | 13% | 1,121 | 12.1% |
Source: Headwaters Economics “The Status of Utah’s Oil and Gas Industry” |
Table (without class)
A basic default table with caption, headings, body, and footer (no colgroups, scopes, or spacings specified): Table captionColumn 1 Heading | Column 2 Heading | Column 3 Heading |
---|---|---|
Footer (with a colspan of 3) | ||
Row 1 cell 1 data | Row 1 cell 2 | Row 1 cell 3 |
Row 2 cell 1 | Row 2 cell 2 | Row 2 cell 3 |
More HTML tags
Form elements
This form code come straight from the WebAIM accessibility site, so it has the proper labels, legends, and fieldsets.Test and textarea
Checkboxes
Radio buttons
Select menus
This menu groups the options (<optgroup>
):
Form control buttons
Preformatted Text
Typographically, preformatted text is not the same as code. For instance, poetry is often rendered with a<pre>
tag.
"Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!"Most browsers default render preformatted text in a monospace font like Courier.
Code
Code can be presented inline, like<?php bloginfo('stylesheet_url'); ?>
, or within a <pre>
block:
#container {
float: left;
margin: 0 -240px 0 0;
width: 100%;
}
Text, one more time
This is: an abbrev.This sentence is within a q tag with cite and title attributes.This sentence is italic. This sentence has emphasis. This sentence is bold. This sentence has strong emphasis. This sentence is small. This sentence is big. This number is superscript1. This number is subscript2.