iPhone
iOS
telephone numbers
styling
text formatting

How do I remove the blue styling of telephone numbers on iPhone/iOS?

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

When developing web applications or creating web content meant for iOS devices like the iPhone, developers often encounter the peculiar behavior of phone numbers being automatically detected and styled as tappable links in the Safari browser. This blue styling indicates an active link, and while convenient for users wishing to quickly dial a number directly from a web page, it may cause unwanted styling issues in certain web designs.

This article will walk you through the technical steps necessary to prevent iOS from styling phone numbers as links, ensuring your design remains consistent across all devices.

Understanding the Behavior

Safari on iOS automatically detects phone numbers in web pages and converts them into clickable links. This feature, known as "Data Detectors," is intended to enhance user experience by providing quick access to call functionality. However, this automatic conversion applies styling which may not align with your site's aesthetic, leading developers to seek ways to suppress it.

Disabling Automatic Conversion

To prevent iOS from automatically styling phone numbers, you can make use of the meta tag in HTML. This tag controls various aspects of how a web page is interpreted and displayed.

  • Meta Tag: This is an HTML tag used to provide structured metadata about a webpage. It often manages how browsers and search engines interpret the page.
  • Attribute name: Here, it specifies the feature being controlled. format-detection refers to the ability of iOS to format specific types of data automatically.
  • Attribute content: This dictates the behavior of the specified feature. Setting telephone=no tells iOS Safari not to format phone numbers as tappable links.
  • Selector a[href^="tel:"]: Targets all anchor tags (``<a>``) where the href attribute begins with "tel:", indicating a telephone link.
  • Properties:
    • color: inherit;: Ensures the link takes on the color of its parent element, preserving the original text color.
    • text-decoration: none;: Removes underlining, maintaining a consistent text appearance with non-link text.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.