Fluid Responsive Typography
How do I make an fluid responsive typography?
What is a fluid responsive typography? How do you make a fluid responsive typography? This script and codes were developed by Jon Milner on 09 December 2022, Friday.
Fluid Responsive Typography - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Fluid Responsive Typography</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container"> <h1>Heading 1 <span></span></h1> <h2>Heading 2 <span></span></h2> <h3>Heading 3 <span></span></h3> <h4>Heading 4 <span></span></h4> <h5>Heading 5 <span></span></h5> <h6>Heading 6 <span></span></h6> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <p><small>Small copy should stay small, but not get too small on smaller screen widths. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</small></p> <div class="box">The padding and font-size will scale, but the border-width will not.</div> <div class="box box--lg">This box is 1.5x larger than the previous one.</div> <div class="box box--static">This box should always be 14px and should not scale at all.</div>
</div> <script src="js/index.js"></script>
</body>
</html>
Fluid Responsive Typography - Script Codes CSS Codes
@import url("https://fonts.googleapis.com/css?family=Roboto+Slab:400,700");
html { font-size: 14px; line-height: 1.5;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { html { font-size: calc(14px + (18 - 14) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { html { font-size: 18px; }
}
h1, h2, h3, h4, h5, h6 { line-height: 1.2; margin: 0; margin-bottom: 1.5rem;
}
h1 span, h2 span, h3 span, h4 span, h5 span, h6 span { opacity: 0.5;
}
h1 { font-size: 32px;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { h1 { font-size: calc(32px + (64 - 32) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { h1 { font-size: 64px; }
}
h2 { font-size: 24px;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { h2 { font-size: calc(24px + (48 - 24) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { h2 { font-size: 48px; }
}
h3 { font-size: 18px;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { h3 { font-size: calc(18px + (32 - 18) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { h3 { font-size: 32px; }
}
h4 { font-size: 16px;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { h4 { font-size: calc(16px + (22 - 16) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { h4 { font-size: 22px; }
}
h5 { font-size: 14px;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { h5 { font-size: calc(14px + (18 - 14) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { h5 { font-size: 18px; }
}
h6 { font-size: 12px;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { h6 { font-size: calc(12px + (14 - 12) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { h6 { font-size: 14px; }
}
p { margin: 0;
}
p:not(:last-child) { margin-bottom: 1.5rem;
}
small { font-size: 0.8em;
}
.box { background-color: rgba(0, 0, 0, 0.1); border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 0.2em; padding: 0.5em 0.75em;
}
.box:not(:last-child) { margin-bottom: 1.5rem;
}
.box--lg { font-size: 1.5rem;
}
.box--static { font-size: 14px;
}
@media screen and (min-width: 320px) and (max-width: 1200px) { .box--static { font-size: calc(14px + (14 - 14) * ((100vw - 320px) / (1200 - 320))); }
}
@media screen and (min-width: 1200px) { .box--static { font-size: 14px; }
}
.container { border: 2px solid #222; margin: 2rem; padding: 2rem;
}
/* ================ */
/* Misc Demo Styles */
/* ================ */
body { color: #222; font-family: "Roboto Slab", sans-serif;
}
Fluid Responsive Typography - Script Codes JS Codes
var elements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
function getFontSize() { for (var i = 0; i < elements.length; i++) { var tag = document.querySelector(elements[i]); var size = window.getComputedStyle(tag).getPropertyValue("font-size"); document.querySelector('' + elements[i] + ' span').innerHTML = '(' + size + ')'; }
}
getFontSize();
window.onresize = function(event) { getFontSize();
};
Developer | Jon Milner |
Username | jonmilner |
Uploaded | December 09, 2022 |
Rating | 3 |
Size | 4,205 Kb |
Views | 36,432 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Animated Multi-Step Progress Bar | 3,802 Kb |
Responsive Hexagon Layout using Sass Mixin | 4,040 Kb |
A Pen by Jon Milner | 3,675 Kb |
Playing Around with BEM | 2,302 Kb |
Custom Form Styles | 4,749 Kb |
Animated Hamburger Menu Icon | 2,952 Kb |
Playing Around with AMCSS | 2,454 Kb |
Atom Loading Icon | 3,333 Kb |
Responsive Card Layout using CSS Columns | 2,651 Kb |
Button Style Matrix - Powered by CSS Custom Properties | 4,874 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Basic template | Tomcat | 1,675 Kb |
Front in Aracaju Logo Pure CSS | Shankarcabus | 2,581 Kb |
Glowing Pulse Form | Jackrugile | 2,542 Kb |
Svg sky | Omodev | 7,070 Kb |
SVG Playground | Roygwells | 1,834 Kb |
SVG Icons Template | Legofsalmon | 2,618 Kb |
Tab Menus | Zephyr | 3,180 Kb |
Wikipedia Viewer | Codinger | 4,681 Kb |
Foundation 5 Menu - Accessibility | Xporter | 1,999 Kb |
Shopping cart | Andiio | 6,581 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!