Styleguide - Also H1 Header

This document is a guide to the mark-up styles used throughout the site. Parts of this markup guide are attributable to Dave Shea, and licensed under a Creative Commons License.

Sections - Also H2 Header

The main page header of this guide is an h1 element. Any header elements may include links, as depicted in the example.

The secondary header above is an h2 element, which may be used for any form of important page-level header. More than one may be used per page. Consider using an h2 unless you need a header level of less importance, or as a sub-header to an existing h2 element.

Third-Level Header - H3

The header above is an h3 element, which may be used for any form of page-level header which falls below the h2 header in a document hierarchy.

Fourth-Level Header - H4

The header above is an h4 element, which may be used for any form of page-level header which falls below the h3 header in a document hierarchy.

Fifth-Level Header - H5

The header above is an h5 element, which may be used for any form of page-level header which falls below the h4 header in a document hierarchy.

Sixth-Level Header - H6

The header above is an h6 element, which may be used for any form of page-level header which falls below the h5 header in a document hierarchy.

Grouping content

Paragraphs

All paragraphs are wrapped in p tags. Additionally, p elements can be wrapped with a blockquote element if the p element is indeed a quote. Historically, blockquote has been used purely to force indents, but this is now achieved using CSS. Reserve blockquote for quotes.

Horizontal rule

The hr element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book. The following extract from Pandora’s Star by Peter F. Hamilton shows two paragraphs that precede a scene change and the paragraph that follows it:

Dudley was ninety-two, in his second life, and fast approaching time for another rejuvenation. Despite his body having the physical age of a standard fifty-year-old, the prospect of a long degrading campaign within academia was one he regarded with dread. For a supposedly advanced civilization, the Intersolar Commonwearth could be appallingly backward at times, not to mention cruel.

Maybe it won’t be that bad, he told himself. The lie was comforting enough to get him through the rest of the night’s shift.


The Carlton AllLander drove Dudley home just after dawn. Like the astronomer, the vehicle was old and worn, but perfectly capable of doing its job. It had a cheap diesel engine, common enough on a semi-frontier world like Gralmond, although its drive array was a thoroughly modern photoneural processor. With its high suspension and deep-tread tyres it could plough along the dirt track to the observatory in all weather and seasons, including the metre-deep snow of Gralmond’s winters.

Blockquotes

The blockquote element represents a section that is being quoted from another source.

Many forms of Government have been tried, and will be tried in this world of sin and woe. No one pretends that democracy is perfect or all-wise. Indeed, it has been said that democracy is the worst form of government except all those other forms that have been tried from time to time.

Winston Churchill, in a speech to the House of Commons. 11th November 1947

Additionally, you might wish to cite the source, as in the above example. The correct method involves including the cite attribute on the blockquote element, but since no browser makes any use of that information, it’s useful to link to the source also.

Ordered list

The ol element denotes an ordered list, and various numbering schemes are available through the CSS (including 1,2,3… a,b,c… i,ii,iii… and so on). Each item requires a surrounding

  • and
  • tag, to denote individual items within the list (as you may have guessed, li stands for list item).

    1. This is an ordered list.
    2. This is the second item, which contains a sub list
      1. This is the sub list, which is also ordered.
      2. It has two items.
    3. This is the final item on this list.

    Unordered list

    The ul element denotes an unordered list (ie. a list of loose items that don’t require numbering, or a bulleted list). Again, each item requires a surrounding

  • and
  • tag, to denote individual items. Here is an example list showing the constituent parts of the British Isles:

    • United Kingdom of Great Britain and Northern Ireland:
      • England
      • Scotland
      • Wales
      • Northern Ireland
    • Republic of Ireland
    • Isle of Man
    • Channel Islands:
      • Bailiwick of Guernsey
      • Bailiwick of Jersey

    Sometimes we may want each list item to contain block elements, typically a paragraph or two.

    • The British Isles is an archipelago consisting of the two large islands of Great Britain and Ireland, and many smaller surrounding islands.

    • Great Britain is the largest island of the archipelago. Ireland is the second largest island of the archipelago and lies directly to the west of Great Britain.

    • The full list of islands in the British Isles includes over 1,000 islands, of which 51 have an area larger than 20 km2.

    Figures

    Figures are usually used to refer to images:

    Example image

    Figure Heading

    This is a placeholder image, with supporting caption.

    Text-level Semantics

    There are a number of inline HTML elements you may use anywhere within other elements.

    Links and anchors

    The a element is used to hyperlink text, be that to another page, a named fragment on the current page or any other location on the web. Example:

    Stressed emphasis

    The em element is used to denote text with stressed emphasis, i.e., something you’d pronounce differently. Where italicizing is required for stylistic differentiation, the i element may be preferable. Example:

    You simply must try the negitoro maki!

    Strong importance

    The strong element is used to denote text with strong importance. Where bolding is used for stylistic differentiation, the b element may be preferable. Example:

    Don’t stick nails in the electrical outlet.

    Small print

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

    Copyright © 1922-2011 Acme Corporation. All Rights Reserved.

    Citations

    The cite element is used to represent the title of a work (e.g. a book, essay, poem, song, film, TV show, sculpture, painting, musical, exhibition, etc). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can just be a work that is mentioned in passing. Example:

    Universal Declaration of Human Rights, United Nations, December 1948. Adopted by General Assembly resolution 217 A (III).

    Inline quotes

    The q element is used for quoting text inline. Example showing nested quotations:

    John said, I saw Lucy at lunch, she told me Mary wants you to get some ice cream on your way home. I think I will get some at Ben and Jerry’s, on Gloucester Road.

    Definition

    The dfn element is used to highlight the first use of a term. The title attribute can be used to describe the term. Example:

    Bob’s canine mother and equine father sat him down and carefully explained that he was an allopolyploid organism.

    Marked or highlighted text

    The mark element is used to represent a run of text marked or highlighted for reference purposes. When used in a quotation it indicates a highlight not originally present but added to bring the reader’s attention to that part of the text. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its relevance to the user’s current activity. Example:

    I also have some kittens who are visiting me these days. They’re really cute. I think they like my garden! Maybe I should adopt a kitten.

    Tabular data

    Tables should be used when displaying tabular data. The thead, tfoot and tbody elements enable you to group rows within each a table.

    If you use these elements, you must use every element. They should appear in this order: thead, tfoot and tbody, so that browsers can render the foot before receiving all the data. You must use these tags within the table element.

    The Very Best Eggnog
    Ingredients Serves 12 Serves 24
    Milk 1 quart 2 quart
    Cinnamon Sticks 2 1
    Vanilla Bean, Split 1 2
    Cloves 5 10
    Mace 10 blades 20 blades
    Egg Yolks 12 24
    Cups Sugar 1 ½ cups 3 cups
    Dark Rum 1 ½ cups 3 cups
    Brandy 1 ½ cups 3 cups
    Vanilla 1 tbsp 2 tbsp
    Half-and-half or Light Cream 1 quart 2 quart
    Freshly grated nutmeg to taste

    Forms

    Forms can be used when you wish to collect data from users. The fieldset element enables you to group related fields within a form, and each one should contain a corresponding legend. The label element ensures field descriptions are associated with their corresponding form widgets.

    Legend
    Note about this field
    Note about this field
    Note about this field
    Note about this field
    Note about this field
    Note about this field
    Note about this selection
    Checkbox *
    Radio