This website lets you generate CSS code to set a property's value based on the viewport width. It essentially helps you do what's described in Modern Fluid Typography Using CSS Clamp, Linearly Scale font-size with CSS clamp() Based on the Viewport and Between the Lines.
vw
You must, but doing it manually is extra work. If you wanted to have a 12px font size on a 280px screen, a 16px font size on a 768px screen, and all sizes inbetween, you'd have to manually create a linear function that goes through both points. This website can do that for you.
Here is an example of the font size being determined by two breakpoints. The stripes denote the area between the breakpoints, where the interpolation happens.
For demonstration purposes, the cqw unit was used to simulate the viewport.
cqw
Although it may be simple to manually make a function such as the one specified above, you may sometimes require more than two points. We call such point a breakpoint (a viewport size and an associated size), and this website lets you specify way more than two of them. Take the following table as an example.
Given the above breakpoints, this website generates the following code which goes through all of them.
font-size: min(12px, 26px + -5vw); @media screen and (min-width: 320px) { font-size: calc(-18px + 8.75vw); } @media screen and (min-width: 480px) { font-size: calc(12px + 2.5vw); } @media screen and (min-width: 640px) { font-size: max(16px, 88px + -9.38vw); }
BSD 3-Clause License Copyright (c) 2006, Ivan Sagalaev. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.