Skip to content

Demos

The most basic use of headings

Just using the H1, H2, etc. components will give you the basic headings.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Regular text

Code Editor
<H1>Heading 1</H1>
<H2>Heading 2</H2>
<H3>Heading 3</H3>
<H4>Heading 4</H4>
<H5>Heading 5</H5>
<H6>Heading 6</H6>
<P>Regular text</P>

Heading typography using React JSX

The visual size of a heading can be customized using the size property with values: xx-large | x-large | large | medium | basis | small | x-small

Heading 1 (default size 'xx-large')

Heading 1 style 'x-large'

Heading 1 style small

Code Editor
<H1>Heading 1 (default size 'xx-large')</H1>
<H1 size="x-large">Heading 1 style 'x-large'</H1>
<H1 size="small">Heading 1 style small</H1>

By using the <small> element, we decrease the size one level (default size is xx-large):

Heading style x-large (using 'size')

Heading style x-large (using <small>)

Code Editor
<H1 size="x-large">Heading style x-large (using 'size')</H1>
<H1>
  <small>Heading style x-large (using &lt;small&gt;)</small>
</H1>

Heading styles in vanilla HTML

Heading style xx-large

Heading style x-large

Heading style large

Heading style small

Heading style basis

Additional Heading modifiers

dnb-h--x-large Normal dnb-h--xx-large

Normal dnb-h--large dnb-h--medium

Normal dnb-h--medium dnb-h--basis

Normal dnb-lead small

Example of margin collapsing

Only the largest margin takes effect.

Spacing with bottom margin: small

Spacing with top margin: large

Code Editor
<H1 size="small" top bottom="small">
  Spacing with bottom margin: small
</H1>
<P top="large" bottom="small">
  Spacing with top margin: large
</P>