Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

There is no single CSS declaration that guarantees one line at every width while keeping text readable and accessible. First identify what is changing: the text may be wrapping, the font may be changing after a web-font load, the font size may be fluid, or the layout may be resizing around it. Usually, let content wrap, use bounded fluid typography with clamp(), and reserve enough layout space. Use white-space: nowrap only for genuinely atomic labels with a safe overflow or expansion fallback.

Identify what is actually resizing

These symptoms look similar but require different fixes:

  • A heading becomes two lines, making its element and a card taller.
  • A fallback font is replaced by a web font, changing glyph widths, line breaks, and line height.
  • font-size changes at a media query or because it uses viewport units.
  • Flex or grid tracks change size because a child has intrinsic content dimensions.
  • nowrap or hidden overflow clips text instead of allowing it to reflow.
  • Browser zoom, operating-system scaling, or a larger default font changes the available space.

In DevTools, inspect the computed font-size, font-family, line-height, inline-size, white-space, and overflow-wrap. Check flex and grid sizing, whether the web font has finished loading, and the browser’s zoom level. Temporarily restore normal wrapping while diagnosing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.problem {
  font-size: inherit;
  white-space: normal;
  overflow-wrap: anywhere;
}

Responsive CSS normally reflows text when its available inline space changes; JavaScript is not required for ordinary wrapping. See MDN’s responsive design guidance.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Default: allow text to wrap

Paragraphs, headings, article titles, labels, and user-generated content should normally be allowed to grow vertically:

.title {
  white-space: normal;
  overflow-wrap: break-word;
}

/* For URLs, hashes, and other unbroken tokens */
.identifier {
  overflow-wrap: anywhere;
}

overflow-wrap protects the container from unusually long tokens. It is different from white-space: nowrap, which forbids ordinary line breaks. Google’s current CSS guidance recommends wrapping long tokens rather than applying nowrap indiscriminately.

Constrain reading width instead of forcing a particular line break:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.prose {
  max-inline-size: 70ch;
  margin-inline: auto;
}

.heading {
  max-inline-size: 20ch;
}

ch is only an approximation because it depends on the font. A flexible block with a maximum measure can shrink on small screens and expand only up to a comfortable line length.

Use bounded fluid typography

If a heading should scale smoothly, put a lower and upper limit around the fluid value:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
:root {
  font-size: 100%;
}

.hero-title {
  font-size: clamp(2rem, 1rem + 5vw, 4rem);
  line-height: 1.05;
}

clamp(minimum, preferred, maximum) lets the preferred value respond to the viewport without allowing an unreadably small or enormous result. Prefer rem or em in the limits so user root-font-size preferences still matter. A bare value such as font-size: 2vw has no safety bounds and can also respond poorly to text-resizing settings. web.dev’s fluid-type guidance explains this accessibility limitation.

For a reusable component, container units can represent its actual available space:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.component {
  container-type: inline-size;
}

.component__title {
  font-size: clamp(1.5rem, 1rem + 2.5cqi, 3rem);
}

/* Use vw instead when container units are not appropriate */
/* font-size: clamp(1.5rem, 1rem + 2.5vw, 3rem); */

Never use cqi or vw as the sole font-size value. A bounded size can still wrap at some widths; that is preferable to shrinking text until it becomes difficult to read.

Improve headline breaks with text-wrap

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
blockquote {
  text-wrap: pretty;
}

text-wrap: balance asks the browser to choose more even line lengths for short headings. It does not shrink the font, change the element’s width, or guarantee one line or exactly two lines. A balanced heading can therefore leave unused space inside a bordered or backgrounded box. Use it deliberately rather than globally; the Chrome explanation of text-wrap balancing documents these limits.

When nowrap is appropriate

A short icon-and-label button, badge, currency token, or status value may be an atomic unit that should not split:

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
.button {
  white-space: nowrap;
}

Use this only when the component can grow, move to another layout, or provide a recovery path. A safer truncating variant is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.single-line {
  max-inline-size: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

Ellipsis is appropriate only when omitted text is nonessential or recoverable through a tooltip, an expanded state, a details view, or a complete accessible name. Do not hide user names, instructions, legal text, or essential navigation. Test translated labels: a phrase that fits in English may be much longer in another language.

Keep variable-height components stable

Do not give headings a fixed height. Let cards grow, or align only the parts that truly require alignment:

.card {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.card-title {
  /* Reserve space only when the product accepts the trade-off */
  min-block-size: 3lh;
}

The lh unit can reserve roughly a chosen number of line boxes where supported, but a fixed minimum must not clip longer content. If a design absolutely requires a fixed visual area, line clamping can provide a controlled presentation:

.card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

Clamping is content loss. Supply an accessible expansion path and never use it for essential instructions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Use container queries for component-level decisions

A viewport breakpoint can be wrong when a card is narrow inside a wide desktop viewport. Container queries respond to the component’s actual parent:

.card-grid {
  container-type: inline-size;
}

.card-title {
  font-size: 1.25rem;
}

@container (min-width: 30rem) {
  .card-title {
    font-size: 1.75rem;
  }
}

Use a container query for discrete structural changes and clamp() for smooth scaling. Combining both is often effective. See Chrome’s container and style query documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Prevent font-loading jumps

With font-display: swap, the fallback font can render first and then be replaced. Different glyph widths, ascent, descent, and line gap can alter wrapping and surrounding layout. Define a tuned fallback face:

@font-face {
  font-family: "Site Fallback";
  src: local("Arial");
  size-adjust: 97%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

body {
  font-family: "Site Fallback", "Site Font", sans-serif;
}

These numbers are examples, not universal values; calculate or tune them for the actual font pair. The relevant controls are size-adjust, ascent-override, descent-override, and line-gap-override. web.dev’s CLS guidance explains how metric matching can reduce, but not eliminate, font-related layout shift.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Preload only fonts needed immediately above the fold, because preloading competes with other critical resources:

Best Value
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
<link rel="preload"
      href="/fonts/site-font.woff2"
      as="font"
      type="font/woff2"
      crossorigin>

Test with the web font blocked and on a slow connection so you can see whether the fallback layout is viable.

Accessibility is the constraint, not an afterthought

Do not make text tiny, disable user resizing, or silently clip content just to preserve a one-line screenshot. WCAG’s practical requirement is that enlarged text remains usable and retains content and functionality; wrapping into more lines is acceptable. Review WCAG technique G179.

  • Check a 320 CSS-pixel viewport and 400% page zoom where applicable.
  • Check 200% text resizing and a larger browser default font size.
  • Test long translations, names, URLs, and user-entered values.
  • Test keyboard focus, screen-reader names, forced-colors, and high-contrast modes.
  • Ensure truncated controls expose the complete value and an obvious way to discover it.

A fixed line count is inherently fragile because font metrics, weight, language, width, letter spacing, and user settings vary. If a headline must look a particular way, editorially shorten it or provide a responsive alternate rather than fitting it with aggressive JavaScript.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Decision table

Goal Preferred approach Trade-off
Readable responsive text clamp() with rem plus viewport or container units It may still wrap
Better headline shape text-wrap: balance No fixed line count or font resizing
Protect against long tokens overflow-wrap: anywhere Breaks can look unusual
Keep a short label intact white-space: nowrap with a layout or overflow fallback Localization and zoom can cause overflow
Reduce font-swap movement Metric overrides and deliberate font loading Requires font-specific tuning
Adapt a component in different parents Container queries Requires container setup and testing

Quick troubleshooting checklist

  1. Confirm whether computed font-size actually changed.
  2. Check the loaded font and weight before and after web-font loading.
  3. Measure the element’s inline size and inspect flex or grid constraints.
  4. Remove accidental nowrap, fixed heights, and overflow: hidden.
  5. Add a sensible measure with max-inline-size.
  6. Use bounded clamp() or a container query only if scaling is the real requirement.
  7. Apply balance to short headings, not as a fitting algorithm.
  8. Retest at narrow widths, 200% text size, 400% zoom, slow fonts, and long translations.

Reliable baseline

:root {
  font-size: 100%;
}

.component {
  container-type: inline-size;
}

.component__title {
  max-inline-size: 25ch;
  font-size: clamp(1.5rem, 1rem + 2.5cqi, 3rem);
  line-height: 1.1;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.component__body {
  max-inline-size: 70ch;
  font-size: 1rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.component__button {
  white-space: nowrap;
}

This pattern accepts natural reflow, limits line length, scales within readable bounds, and reserves nowrap for the one element whose label is intentionally atomic. Adjust it to the content and test conditions rather than treating it as a magic declaration.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.