Inspect Control CSS Text Size Adjust in Safari Web Inspector
In this article
- What Is text-size-adjust and Why Does It Matter?
- How to Access the Web Inspector in Safari
- Finding the Property in the Styles Pane
- Common Values and Their Effects
- Why You Might Not See the Property in the Inspector
- Common Problems and Solutions
- Comparing Safari with Other Browsers
- Frequently Asked Questions
To inspect the text-size-adjust CSS property in Safari's Web Inspector, open the Elements tab, select the element, and look in the Styles pane—Safari shows the property as -webkit-text-size-adjust. You can also use the Computed tab to see the final applied value, and you can toggle or edit the property directly from the Styles pane to test changes live.
What Is text-size-adjust and Why Does It Matter?
The text-size-adjust property (prefixed as -webkit-text-size-adjust in Safari and older Chrome) controls whether the browser automatically inflates font sizes on pages designed for desktop when viewed on a small screen. Safari on iOS and macOS applies this auto-inflation by default, which can cause unexpected font scaling in responsive layouts. Developers often set -webkit-text-size-adjust: 100% or none to prevent this behavior, ensuring text sizes match the CSS exactly.
Without this property, a desktop-oriented page might render text disproportionately large on an iPhone, breaking the design. Conversely, setting it to none can harm accessibility if users rely on Safari's text-size adjustment. Understanding how to inspect and modify it in Web Inspector is essential for debugging responsive issues.
How to Access the Web Inspector in Safari
Before you can inspect the property, you need to enable the Develop menu. Here’s how:
- Open Safari and go to Settings (or Preferences) > Advanced.
- Check the box next to Show features for web developers.
- Now you can right-click (or Control-click) on any element on a page and choose Inspect Element.
- Alternatively, press Option+Command+I (macOS) to open Web Inspector directly.
On iOS, you need to connect your device to a Mac and enable Web Inspector in Safari's settings on both devices. The inspector then appears on the Mac.
Finding the Property in the Styles Pane
Once Web Inspector is open, follow these steps to locate -webkit-text-size-adjust:
- Select the element whose text size you want to inspect, either by clicking it in the page or using the element picker (the arrow icon in the toolbar).
- In the Styles pane on the right, look for the rule that applies the property. It may be in a CSS file or inline style.
- If you don't see it, check the Computed tab—type "text-size" in the filter box to see the final value.
- To edit, click the property name or value in the Styles pane and type a new value. The change applies immediately, so you can test different settings without reloading.
If the property is not present, Safari will show the default behavior (usually auto). You can add it by clicking the + button in the Styles pane and typing -webkit-text-size-adjust.
Common Values and Their Effects
Here are the typical values you'll encounter and what they do:
auto– The default. Safari may inflate text on small screens if it thinks the layout is not optimized.none– Disables auto-inflation entirely. Text stays exactly as sized in CSS, which can cause readability issues on small screens if the base font is too small.100%– A common workaround that prevents inflation while preserving the user's ability to zoom. It's effectively the same asnonefor most practical purposes.80%or other percentages – Allows some inflation but limits it to a percentage of the original size.
In practice, most developers use 100% because it stops unwanted scaling without breaking accessibility. However, note that none might be ignored by some browsers for accessibility reasons; Safari on iOS still respects it, but it's better to use 100%.
Why You Might Not See the Property in the Inspector
Sometimes you expect to see -webkit-text-size-adjust but it's not visible. Possible reasons:
- The property is not explicitly set in any CSS rule; it's just using the browser default.
- It's defined in a media query that doesn't match the current viewport (e.g., only for small screens).
- The rule is overridden by a more specific selector or a later declaration.
- You're looking at the wrong element—text inflation applies to the containing block, not the inline text node.
To debug, use the Computed tab to see the actual value. If it shows auto, then no rule is applying. You can also check the Rules tab to see all matching rules and their specificity.
Common Problems and Solutions
Here are frequent issues developers encounter with text-size-adjust and how to fix them:
- Text too large on mobile: Add
-webkit-text-size-adjust: 100%to thehtmlorbodyrule. - Text too small after setting
none: Use100%instead, and ensure your base font size is at least 16px for readability. - Property not working in Safari: Make sure you're using the
-webkit-prefix; Safari may not recognize the unprefixed version. - Inflation still happening after setting
100%: Check if another rule (like a universal selector) is overriding it. Use the Inspector to verify the computed value.
Remember that this property only affects Safari and older Chrome; Firefox and Edge use the standard text-size-adjust (without prefix), but they rarely auto-inflate text anyway.
Comparing Safari with Other Browsers
Safari's auto-inflation behavior is unique; Chrome on Android does not inflate text by default, and Firefox has never implemented it. This means the property is mostly relevant for iOS Safari and macOS Safari (when viewing pages in a narrow window). In Web Inspector, you'll only see the -webkit- prefix in Safari. Other browsers might show the unprefixed property in their DevTools, but it's often ignored. When testing cross-browser, you should set both prefixed and unprefixed versions to ensure future compatibility.
Frequently Asked Questions
Why does Safari show -webkit-text-size-adjust but not text-size-adjust?
Safari uses the WebKit engine, which historically required the -webkit- prefix for this property. The unprefixed version is not yet supported in Safari, so Web Inspector only recognizes the prefixed one. You should always include the prefixed version for Safari.
Does text-size-adjust affect desktop Safari?
Yes, but only when the browser window is narrow enough to trigger auto-inflation. On a full-width desktop window, the property has no visible effect because there's no inflation. You can test by resizing the window in Safari.
Can I use text-size-adjust to make text smaller on mobile?
No, the property only controls whether the browser inflates text; it does not allow you to shrink text below the CSS-specified size. To make text smaller, you need to adjust the font-size in your CSS.
Is it safe to set -webkit-text-size-adjust: none?
It's generally safe, but it can hurt accessibility for users who rely on Safari's text-size adjustment. The recommended value is 100%, which prevents unwanted inflation while preserving the user's ability to zoom.
Why does my text-size-adjust rule not work in the Inspector?
Check if the rule is being overridden by a more specific selector or if it's inside a media query that doesn't apply. Use the Computed tab to see the final value. Also ensure you're editing the correct element—the property affects the entire containing block, not just the text node.