On Github zellwk / responsive-typography-slides
Freelance developer in Singapore
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole. The nuckelavee's breath can wilt crops and sicken livestock, and the creature was held responsible for droughts and epidemics on land despite its being predominantly a sea-dweller.
When Dorothy stood in the doorway and looked around, she could see nothing but the great gray prairie on every side. Not a tree nor a house broke the broad sweep of flat country that reached to the edge of the sky in all directions. The sun had baked the plowed land into a gray mass, with little cracks running through it. Even the grass was not green, for the sun had burned the tops of the long blades until they were the same gray color to be seen everywhere. Once the house had been painted, but the sun blistered the paint and the rains washed it away, and now the house was as dull and gray as everything else.
html { font-size: 16px; // Minimum of 16px on mobile line-height: 1.4; // 1.3 - 1.6 } p { width: 30em; // 45 - 75 characters }
html { font-size: 16px; } h1 { font-size: 50.517px; } // 16px * 1.333 * 1.333 * 1.33 * 1.33 h2 { font-size: 37.897px; } // 16px * 1.333 * 1.333 * 1.33 h3 { font-size: 28.430px; } // 16px * 1.333 * 1.333
html { line-height: 24px; } h1 { line-height: 48px; margin: 24px 0; } p { margin: 24px 0; }
body { background: repeating-linear-gradient( to bottom, transparent 0px, transparent 23px, red 23px, red 24px ); }
html { font-size: 16px; line-height: 24px; } h1 { font-size: 50px; } // 1.333 * 1.333 * 1.333 * 1.333
html { font-size: 16px; line-height: 24px; } h1 { font-size: 50px; line-height: 72px; // 24px * 3; }
This is a header with two lines of text
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
h1 { font-size: 50px; line-height: 48px; // 24px * 2. Line height of 0.96 }
This is a header with two lines of text
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
h1 { font-size: 50px; line-height: 60px; // 60px = 2.5 * 24px. Line height = 1.2 }
This is a header with two lines of text
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife. Their house was small, for the lumber to build it had to be carried by wagon many miles. There were four walls, a floor and a roof, which made one room; and this room contained a rusty looking cookstove, a cupboard for the dishes, a table, three or four chairs, and the beds. Uncle Henry and Aunt Em had a big bed in one corner, and Dorothy a little bed in another corner. There was no garret at all, and no cellar–except a small hole dug in the ground, called a cyclone cellar, where the family could go in case one of those great whirlwinds arose, mighty enough to crush any building in its path. It was reached by a trap door in the middle of the floor, from which a ladder led down into the small, dark hole.
html { font-size: 16px; @media (min-width: 600px) { font-size: 18px; } @media (min-width: 1000px) { font-size: 20px; } }
html { font-size: 16px; @media (min-width: 600px) { font-size: 18px; } } h1 { font-size: 50.517px; @media (min-width: 600px) { font-size: 56.83px; } } // ... and so on
html { font-size: 16px; @media (min-width: 600px) { font-size: 18px; } } h1 { font-size: 3.157rem } // 1.333 * 1.333 * 1.333 * 1.333 h3 { font-size: 2.369rem } // 1.333 * 1.333 * 1.333 h2 { font-size: 1.777rem } // 1.333 * 1.333
h1 { font-size: 20px } /* 1em = 20px */ p { font-size: 16px } /* 1em = 16px */
html { font-size: 16px } h1 { font-size: 2em } /* 16px * 2 = 32px */
h1 { font-size: 2em; /* 1em = 16px */ margin-bottom: 1em; /* 1em = 32px */ } p { font-size: 1em; /* 1em = 16px */ margin-bottom: 1em; /* 1em = 16px */ }
html { font-size: 16px } /* 1rem === 16px, always */
h1 { font-size: 2rem; /* 1rem = 16px */ margin-bottom: 1rem; /* 1rem = 16px */ } p { font-size: 1rem; /* 1rem = 16px */ margin-bottom: 1rem; /* 1rem = 16px */ }
html { font-size: 16px; @media (min-width: 600px) { font-size: 18px; } } h1 { font-size: 3.157rem; } // 1.333 * 1.333 * 1.333 * 1.333 h2 { font-size: 2.369rem; } // 1.333 * 1.333 * 1.333 h3 { font-size: 1.777rem; } // 1.333 * 1.333
html { font-size: calc(1em + 0.25vw); } h1 { font-size: 3.157rem; } // 1.333 * 1.333 * 1.333 * 1.333 h2 { font-size: 2.369rem; } // 1.333 * 1.333 * 1.333 h3 { font-size: 1.777rem; } // 1.333 * 1.333
html { font-size: 1em; // Scales by 1px for every 100px from 600px onwards @media (min-width: 600px) { font-size: calc(1.125em + 4 * (100vw - 600px) / 400); } // Sets font-size to 22px after a viewport of 1000px @media (min-width: 1000px) { font-size: 1.375em; } } // h1, h2, h3...
html { font-size: 16px; @media (min-width: 600px) { font-size: 18px; } } h1 { font-size: 3.157rem; } // 1.333 * 1.333 * 1.333 * 1.333 h2 { font-size: 2.369rem; } // 1.333 * 1.333 * 1.333 h3 { font-size: 1.777rem; } // 1.333 * 1.333
html { font-size: 16px; @media (min-width: 600px) { font-size: 18px; } } h1 { font-size: 2.369rem; // 1.333 * 1.333 * 1.333 @media (min-width: 600px) { font-size: 3.157rem; // 1.333 * 1.333 * 1.333 * 1.333 } }
h1 { font-size: 2.369rem; // 1.333 * 1.333 * 1.333 @media (min-width: 600px) { font-size: 3.157rem; // 1.333 * 1.333 * 1.333 * 1.333 } } h2 { font-size: 1.777rem; // 1.333 * 1.333 @media (min-width: 600px) { font-size: 2.369rem; // 1.333 * 1.333 * 1.333 } } h3 { font-size: 1.333rem; // 1.333 @media (min-width: 600px) { font-size: 1.777rem; // 1.333 * 1.333 } } // ...
html { line-height: 1.4; @media (min-width: 1000px) { line-height: 1.5; } }
h1 { margin: 1.4rem; @media (min-width: 1000px) { margin 1.5rem; } } h2 { margin: 1.4rem; @media (min-width: 1000px) { margin 1.5rem; } } //... Every property that requires Vertical Rhythm calculation!
:root { --baseline: 1.4; @media (min-width: 1000px) { --baseline: 1.5; } } html { line-height: var(--baseline); } h1 { margin: calc(var(--baseline) * 2); }
So... don't change your baseline! (until Edge ships CSS Variables)
So... don't change your baseline! (or use @supports if you don't care about Edge)
// Configuring Typi \$breakpoints: ( small: 600px, large: 1000px ); \$typi: ( null: (16px, 1.4), small: 18px, large: (20px, 1.5) );
// Using Typi html { @include typi-base(); }
/* CSS Output */ html { font-size: 100%; line-height: 1.4; } @media all and (min-width: 600px) { html { font-size: 112.5%; } } @media all and (min-width: 1000px) { html { font-size: 125%; line-height: 1.5; } }
// Scss input \$h1-map: ( null: (2.369em, 1.2), large: (3.157em, 1.3) ); h1 { @include typi(\$h1-map); }
/* CSS Output */ h1 { font-size: 2.369rem; line-height: 1.2; } @media all and (min-width: 1000px) { h1 { font-size: 3.157rem; line-height: 1.3; } }
// Scss input \$ms-ratio: 1.333; \$h1-map: ( null: (ms(2), 1.2), large: (ms(3), 1.3) ); \$h2-map: ( null: (ms(1), 1.2), large: ms(2) ); h1 { @include typi(\$h1-map); } h2 { @include typi(\$h2-map); }
/* CSS Output */ h1 { font-size: 2.369rem; line-height: 1.2; } @media all and (min-width: 1000px) { h1 { font-size: 3.157rem; line-height: 1.3; } } h2 { font-size: 2.369rem; } @media all and (min-width: 1000px) { h2 { font-size: 1.777rem; } }
// Configure Typi \$breakpoints: (/* ... */); \$typi: (/* ... */); // Use Typi html { @include typi-base(); } h1 { @include typi(\$h1-map); } h2 { @include typi(\$h2-map); } h3 { @include typi(\$h3-map); }
html { font-size: 100%; line-height: 1.5; } h1 { margin: 24px; line-height: 60px; }
html { font-size: 100%; line-height: 1.5; } h1 { margin: 1.5rem; // 1.5rem == 24px. 1 Baseline line-height: 3.75rem; // 3.75rem == 60px. 2.5 Baselines }
html { font-size: 100%; line-height: 1.5; } h1 { margin: vr(1); // 1 Baseline line-height: vr(2.5); // 2.5 Baselines }