Headings create structure. They provide a quick way to scan the main sections of a website.
There a few style variants for headings:
Simply add the title class on any heading element (according SEO guidelines) to apply this style. It isn’t required to use these classes on the default heading element provided.
{% if type == "overview-title" %}
<{{ heading|default('h1') }} class="overview-title{% if heading_class %} {{ heading_class }}{% endif %}">{{ heading_text }}</{{ heading|default('h1') }}>
{% elseif type == "bg-primary" %}
<{{ heading|default('h1') }} class="bg-primary{% if heading_class %} {{ heading_class }}{% endif %}"><span>{{ heading_text }}</span></{{ heading|default('h1') }}>
{% elseif type == "bg-none" %}
<{{ heading|default('h1') }} class="bg-none{% if heading_class %} {{ heading_class }}{% endif %}"><span>{{ heading_text }}</span></{{ heading|default('h1') }}>
{% else %}
<{{ heading }}{% if heading_class %} class="{{ heading_class }}"{% endif %}>{{ heading_text }}</{{ heading }}>
{% endif %}
<h4 class="bg-primary"><span>Heading with background H4 desktop</span></h4>
{
"heading": "h4",
"heading_text": "Heading with background H4 desktop",
"type": "bg-primary"
}
h1,
.h1,
%h1,
h2,
.h2,
%h2,
h3,
.h3,
%h3,
h4,
.h4,
%h4,
h5,
.h5,
%h5 {
@include bold-text;
margin-top: 40px;
font-style: normal;
&:first-child {
margin-top: 0;
}
// If the heading is preceded by any empty first-child element, strip its top
// margin.
*:first-child:empty + & {
margin-top: 0;
}
button {
display: flex;
padding: 0;
border: 0;
background: none;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
line-height: inherit;
cursor: pointer;
i {
font-size: inherit;
}
}
}
h1,
.h1,
%h1 {
margin-bottom: 20px;
& + h2,
& + .h2 {
margin-top: 0;
}
}
h2,
.h2,
%h2 {
margin-bottom: 15px;
@include mobile {
margin-bottom: 20px;
}
& + h3,
& + .h3 {
margin-top: 0;
}
}
h3,
.h3,
%h3 {
margin-bottom: 15px;
& + h4,
& + .h4 {
margin-top: 0;
}
}
h4,
.h4,
%h4 {
margin-bottom: 15px;
& + h5,
& + .h5 {
margin-top: 0;
}
}
h5,
.h5,
%h5 {
margin-bottom: 15px;
& + h6,
& + .h6 {
margin-top: 0;
}
}