<p>This text's font size grows from 1rem to 3rem as the viewport's width grows from 320 to 960 pixels.</p>

<p>As more diverse screen sizes became available, the concept of responsive web design (RWD) appeared, a set of practices that allows web pages to alter their layout and appearance to suit different screen widths, resolutions, etc. It is an idea that changed the way we design for a multi-device web, and in this article, we'll help you understand the main techniques you need to know to master it.</p>

  For years, I couldn’t seem to find a recipe for brownies that met my standards. Anytime I made homemade brownies, I wanted them to be just like the ones I ate as a kid – super fudgy, moist, and chocolaty, with crispy edges and crackly tops. But the thing is, these brownies didn’t come from a recipe. We always made them from a box. Nowadays, I prefer to bake from scratch, but no brownie recipe I tried could live up to the chocolate brownies of my childhood.

So this fall, as I flipped through Michelle Lopez’s new book Weeknight Baking, her recipe for Boxed Mix Brownies, From Scratch caught my eye. Would I finally be able to make homemade brownies that would be just as delicious as the ones from a box?

The verdict: yes! I’ve had this brownie recipe on repeat since the first time I tried it. It calls for basic pantry ingredients, and it’s hardly more difficult than using a mix. As for the brownies, they’re true perfection – glossy, fudgy, and filled with rich chocolate flavor. Trust me, you’re going to want to make them ASAP!

Another thing you should do ASAP is check out Weeknight Baking! This book is packed with crave-worthy recipes that are meant for busy weeknights. Each one comes with fun variations (I have my eye on the matcha snickerdoodles) as well as tips for becoming a more efficient baker. After years of juggling a 9-to-5 job and running her blog, Hummingbird High, Michelle is full of wisdom on how to bake on a busy schedule. She writes, “We’re all doing the best we can with what we have. And I’m going to help you bake any night of the week that works for you.” If you love baking, you’ll love this book.
  font-family: 'Montserrat', sans-serif;
function clampBuilder(minWidthPx, maxWidthPx, minFontSize, maxFontSize) {
  const root = document.querySelector("html");
  const pixelsPerRem = Number(getComputedStyle(root).fontSize.slice(0, -2));

  const minWidth = minWidthPx / pixelsPerRem;
  const maxWidth = maxWidthPx / pixelsPerRem;

  const slope = (maxFontSize - minFontSize) / (maxWidth - minWidth);
  const yAxisIntersection = -minWidth * slope + minFontSize;

  return `clamp(${minFontSize}rem, ${yAxisIntersection}rem + ${
    slope * 100
  }vw, ${maxFontSize}rem)`;

function calculateCh(element, fontSize) {
  const zero = document.createElement("span");
  zero.innerText = "0";
  zero.style.position = "absolute";
  zero.style.fontSize = fontSize;

  const chPixels = zero.getBoundingClientRect().width;

  return chPixels;

document.querySelectorAll("p").forEach((p) => {
  p.style.fontSize = clampBuilder(320, 960, 1, 3);
  p.style.width = `${(320 / calculateCh(p, "1rem")) * 0.9}ch`;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.