Skip to main content

Responsive Text

Live preview of the Responsive Text element in the Salient WordPress theme. A chart of font size against viewport width: flat at the minimum, rising through the fluid middle, flat at the maximum, with specimens on the curve and a marker at the reader's own viewport width. Sample content, for demonstration only.

The Responsive Text element renders a block of text that scales with the width of the viewport rather than jumping between fixed sizes at each breakpoint. A headline sized to fill its column on a desktop keeps those proportions on a tablet and a phone, instead of wrapping awkwardly or needing a separate size for every device.

It suits any type that is doing a layout job as much as a reading job:

  • Oversized hero headlines
  • Display quotes and statements
  • Section titles that should span their column edge to edge
  • Large numerals or short labels used as graphic elements
The three sizes together make a clamp

Salient combines the size and its two bounds into a single CSS rule: the browser takes whichever is larger of the minimum and the fluid size, then whichever is smaller of that and the maximum. The result behaves exactly like clamp(min, 6vw, max): flat at the floor, rising with the window in between, flat at the ceiling.

For the same idea applied across the whole site rather than one block, see Fluid Typography, which drives the theme's headings this way.

Usage​

  1. Add the Element: In the Salient WPBakery page builder, click Add Element and choose Responsive Text.
  2. Enter Your Text: Type the content into the Text field.
  3. Inherit a Font Style: Point Font Style at a heading tag so the text picks up that tag's family and weight.
  4. Set a Viewport-Relative Size: Put a vw value into Custom Font Size, 6vw say. That is what makes the text scale rather than step.
  5. Pin the Ends: Set Min Font Size and Max Font Size so the text stops shrinking on a phone and stops growing on a very wide screen.
  6. Check It at Both Ends: Preview at desktop and phone widths. Scaling text is the one case where the middle sizes rarely surprise you, but the extremes do.

Options​

  • Text Text The content of the block. The field accepts HTML, so links and inline formatting are available.
  • Font Style Choice Inherits styling from an existing tag rather than defining a new one: H1 through H6, Paragraph, or Italic. Default leaves the text with the element's own styling.
  • Custom Font Size NumberResponsive. Set a different value for desktop, tablet and phone. The size. Any CSS length works, and a viewport unit is what makes the text fluid: 6vw is six percent of the window's width, so it grows and shrinks with it.
  • Min Font Size and Max Font Size The floor and ceiling for the size above. These are what keep a vw value usable; without them the text has no lower limit on a narrow phone and no upper limit on a wide monitor.
  • Line Height Number The line height for the block. Large type usually wants a tighter value than body text.
  • Text Indent NumberResponsive. Set a different value for desktop, tablet and phone. Indents the first line.
  • Text Color Color The color of the text. Left unset, it follows the light or dark text color of the row it sits in.
  • Max Width Number An optional maximum width. Without it the text scales with its container indefinitely, which on very wide screens can push a headline past a comfortable reading measure.
  • Link URL Text Turns the text into a link to this address.
  • Text Direction Choice Sets the text direction for right-to-left languages.
  • CSS Class Name Code Adds your own class to the element for targeting from custom CSS.