# Turn On Fluid Typography

> Makes font sizes from the theme presets scale smoothly between phone and desktop widths, so large headings never overflow on small screens.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: theme-json, typography, responsive
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/themejson-fluid-typography/

## Code

```php
// Screen widths between which sizes scale.
$wpide_fluid_min = '360px';
$wpide_fluid_max = '1280px';

add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) use ( $wpide_fluid_min, $wpide_fluid_max ) {
    return $theme_json->update_with( array(
        'version'  => WP_Theme_JSON::LATEST_SCHEMA,
        'settings' => array(
            'typography' => array(
                'fluid' => array(
                    'minViewportWidth' => $wpide_fluid_min,
                    'maxViewportWidth' => $wpide_fluid_max,
                ),
            ),
        ),
    ) );
} );
```

## Notes

Change the viewport range to control where scaling starts and stops.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Turn On Fluid Typography" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
