# Typography
The usual technique for making your website look good on mobiles is to reduce text sizes and margins between elements as the screen becomes smaller. This requires you to set different breakpoints and define how each element should look at particular screen widths.
But itβs impossible to consider the literally infinite number of different screens. Asli has a cool feature for smoothly tailoring text sizes depending on viewport width. It's called Fluid Typography (opens new window). It allows you to define a minimum and a maximum value for a property (for example, font-size), and then it will smoothly shrink and grow depending on the screen size. Automatically. Without writing a single breakpoint rule!
# Typographic Presets
The typographic presets used throughout the template are defined as CSS variables in π css/main.css under the :root selector.
/* Typography */
:root {
--font-primary: "Nunito Sans", sans-serif;
--font-secondary: "Butler", serif;
/* Paragraph */
--paragraph-font-family: var(--font-primary);
--paragraph-min-font-size: 16;
--paragraph-max-font-size: 18;
--paragraph-min-line-height: 24;
--paragraph-max-line-height: 32;
--paragraph-letter-spacing: 0;
--paragraph-color-light-theme: #20211F;
--paragraph-color-dark-theme: #dfdfdf;
--paragraph-color: var(--paragraph-color-light-theme);
/* Buttons */
--ui-element-font-family: var(--font-primary);
--ui-element-min-font-size: 14;
--ui-element-max-font-size: 16;
--ui-element-font-weight: 600;
--ui-element-line-height: 1;
--ui-element-letter-spacing: 0;
--ui-element-color-light-theme: #20211F;
--ui-element-color-dark-theme: #fff;
--ui-element-color: var(--ui-element-color-light-theme);
/* Display XXL * */
--display-xxl-font-family: var(--font-secondary);
--display-xxl-max-font-size: 288;
--display-xxl-min-font-size: 80;
--display-xxl-font-weight: 200;
--display-xxl-line-height: 1.2;
--display-xxl-letter-spacing: -0.02em;
--display-xxl-color-light-theme: #20211F;
--display-xxl-color-dark-theme: #ffffff;
--display-xxl-color: var(--display-xxl-color-light-theme);
/* Display XL * */
--display-xl-font-family: var(--font-secondary);
--display-xl-max-font-size: 216;
--display-xl-min-font-size: 80;
--display-xl-font-weight: 200;
--display-xl-line-height: 1.2;
--display-xl-letter-spacing: -0.02em;
--display-xl-color-light-theme: #20211F;
--display-xl-color-dark-theme: #ffffff;
--display-xl-color: var(--display-xl-color-light-theme);
/* Display caps */
--display-caps-font-family: var(--font-secondary);
--display-caps-max-font-size: 144;
--display-caps-min-font-size: 48;
--display-caps-font-weight: 200;
--display-caps-line-height: 1.2;
--display-caps-letter-spacing: 0.06em;
--display-caps-color-light-theme: #20211F;
--display-caps-color-dark-theme: #ffffff;
--display-caps-color: var(--display-caps-color-light-theme);
/* Heading 1 */
--h1-font-family: var(--font-secondary);
--h1-max-font-size: 170;
--h1-min-font-size: 54;
--h1-font-weight: 200;
--h1-line-height: 1.2;
--h1-letter-spacing: -0.01em;
--h1-color-light-theme: #20211F;
--h1-color-dark-theme: #ffffff;
--h1-color: var(--h1-color-light-theme);
/* Heading 2 */
--h2-font-family: var(--font-secondary);
--h2-max-font-size: 144;
--h2-min-font-size: 48;
--h2-font-weight: 200;
--h2-line-height: 1.2;
--h2-letter-spacing: -0.01em;
--h2-color-light-theme: #20211F;
--h2-color-dark-theme: #ffffff;
--h2-color: var(--h2-color-light-theme);
/* Heading 3 */
--h3-font-family: var(--font-secondary);
--h3-max-font-size: 86;
--h3-min-font-size: 42;
--h3-font-weight: 200;
--h3-line-height: 1.2;
--h3-letter-spacing: 0;
--h3-color-light-theme: #20211F;
--h3-color-dark-theme: #ffffff;
--h3-color: var(--h3-color-light-theme);
/* Heading 4 */
--h4-font-family: var(--font-secondary);
--h4-max-font-size: 54;
--h4-min-font-size: 32;
--h4-font-weight: 300;
--h4-line-height: 1.25;
--h4-letter-spacing: 0;
--h4-color-light-theme: #20211F;
--h4-color-dark-theme: #ffffff;
--h4-color: var(--h4-color-light-theme);
/* Heading 5 */
--h5-font-family: var(--font-primary);
--h5-max-font-size: 30;
--h5-min-font-size: 18;
--h5-font-weight: 700;
--h5-line-height: 1.3;
--h5-letter-spacing: 0;
--h5-color-light-theme: #20211F;
--h5-color-dark-theme: #ffffff;
--h5-color: var(--h5-color-light-theme);
/* Heading 6 */
--h6-font-family: var(--font-primary);
--h6-max-font-size: 20;
--h6-min-font-size: 16;
--h6-font-weight: 700;
--h6-line-height: 1.3;
--h6-letter-spacing: 0;
--h6-color-light-theme: #20211F;
--h6-color-dark-theme: #ffffff;
--h6-color: var(--h6-color-light-theme);
/* Blockquote */
--blockquote-font-family: var(--font-primary);
--blockquote-max-font-size: 24;
--blockquote-min-font-size: 18;
--blockquote-font-weight: 400;
--blockquote-line-height: 1.33;
--blockquote-letter-spacing: 0;
--blockquote-color-light-theme: #20211F;
--blockquote-color-dark-theme: #ffffff;
--blockquote-color: var(--blockquote-color-light-theme);
/* Dropcap */
--dropcap-font-family: var(--font-secondary);
--dropcap-max-font-size: 112;
--dropcap-min-font-size: 52;
--dropcap-font-weight: 200;
--dropcap-line-height: 0.7;
--dropcap-letter-spacing: 0;
--dropcap-color-light-theme: #20211F;
--dropcap-color-dark-theme: #ffffff;
--dropcap-color: var(--dropcap-color-light-theme);
/* Subheading */
--subheading-font-family: var(--font-primary);
--subheading-max-font-size: 13;
--subheading-min-font-size: 11;
--subheading-font-weight: 700;
--subheading-line-height: 1.3;
--subheading-letter-spacing: 0.15em;
--subheading-color-light-theme: #20211F;
--subheading-color-dark-theme: #dfdfdf;
--subheading-color: var(--subheading-color-light-theme);
/* Overlay menu item */
--overlay-menu-item-font-family: var(--font-secondary);
--overlay-menu-item-max-font-size: 144;
--overlay-menu-item-min-font-size: 42;
--overlay-menu-item-font-weight: 200;
--overlay-menu-item-line-height: 1.2;
--overlay-menu-item-letter-spacing: -0.01em;
--overlay-menu-item-color-light-theme: #20211F;
--overlay-menu-item-color-dark-theme: #ffffff;
--overlay-menu-item-color: var(--overlay-menu-item-color-light-theme);
/* Overlay submenu item */
--overlay-submenu-item-font-family: var(--font-secondary);
--overlay-submenu-item-max-font-size: 54;
--overlay-submenu-item-min-font-size: 32;
--overlay-submenu-item-font-weight: 300;
--overlay-submenu-item-line-height: 1.2;
--overlay-submenu-item-letter-spacing: 0;
--overlay-submenu-item-color-light-theme: #20211F;
--overlay-submenu-item-color-dark-theme: #ffffff;
--overlay-submenu-item-color: var(--overlay-submenu-item-color-light-theme);
/* Super label */
--super-label-font-family: var(--font-primary);
--super-label-max-font-size: 18;
--super-label-min-font-size: 12;
--super-label-font-weight: 700;
--super-label-line-height: 1;
--super-label-letter-spacing: 0;
--super-label-color-light-theme: #20211F;
--super-label-color-dark-theme: #ffffff;
--super-label-color: var(--super-label-color-light-theme);
}
# From 360px (Screen resolution of an average smartphone)
The minimum value with the *-min-font-size suffix defines the actual font size for the smallest screen sizes down to 360px.
# To 1920px (Full HD resolution)
The maximum value with the *-max-font-size suffix defines the actual font size for the largest screen sizes up to 1920px.
# Helper Classes
Use one of the following classes (presets) to style a text element in your HTML markup:
/* Display headings */
.display-xxl /* large heading */
.display-xl /* medium heading */
.display-caps /* ALL-UPPERCASE HEADING */
/* Standard headings */
.h1 /* h1 heading */
.h2
.h3
.h4
.h5
.h6
/* Subheading (small caps) */
.subheading
/* Overlay Menu Item */
.overlay-menu-item
/* Overlay Submenu item */
.overlay-submenu-item
/* Paragraph */
.paragraph
/* UI Element (button, caption, additional label, etc) */
.ui-element
/* Dropcap */
.dropcap
/* Super (small label next to a heading) */
.super-label
/* Make text bold (strong weight) */
.strong
/* Make text italic */
.italic
You can use the classes above in conjunction with any HTML tags. This gives great flexibility when writing SEO-friendly markup:
<!-- h1 heading with h1 style -->
<h1>My Heading</h1>
<!-- Still h1 heading but with h3 style -->
<h1 class="h3">My Heading</h1>
<!-- h2 heading but with display in caps style -->
<h2 class="display-caps">My Heading</h2>
<!-- Regular <span> element but with h4 style -->
<span class="h4">My Content</span>
<!-- Regular <div> element but with paragraph and drop cap style -->
<div class="paragraph has-drop-cap">My Content</div>