# How to choose and implement web-safe HTML fonts

With HTML fonts, you can give text on your web pages an individual touch. For the best possible user-friendliness, you should always use web-safe fonts.

## Which HTML fonts are available?

In theory, there is a huge number of different HTML fonts. As [HTML](https://www.ionos.co.uk/digitalguide/websites/web-development/what-is-html/) itself does not provide a font, you can technically use any font for your web pages as long as you upload and configure it correctly. However, there are various problems that could arise if you do this. In particular, ornate or small fonts are often **not rendered as desired**. This not only has a negative effect on the design of the pages, but also negatively impacts readability. Problems can also occur if an HTML font is not **installed** on the computer of the person visiting your site.

## Web-safe HTML fonts

If you’re looking for suitable fonts for your website, you should use web-safe fonts. These are **pre-installed** on most systems or available as web fonts via public servers. This ensures that there are no problems with rendering and that your website is displayed consistently in different browsers and operating systems.

### Web-safe fonts

Web-safe fonts are those that are pre-installed on most devices and operating systems. The best-known web-safe fonts include:

- Arial
- Courier New
- Helvetica
- Times New Roman
- Georgia
- Verdana

These fonts are widely used and offer a high level of compatibility.

### Web fonts

In addition to pre-installed fonts, you can also use [web fonts](https://www.ionos.co.uk/digitalguide/websites/web-design/web-fonts-the-power-of-modern-typography/). Web fonts are loaded from public servers and offer a large selection of typographic styles. One popular provider of web fonts is Google Fonts. Using web fonts allows you to personalise your website’s design without affecting compatibility. Below is an example of how to include a web font:

```html

<html>
<head>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Roboto', sans-serif;
        }
    </style>
</head>
<body>
    <p>This is a text that uses the Roboto web font.</p>
<div class="hash d-none" hidden>hash_7b53c346525db4f9fa10cb7e453582d4b9132ce0</div><script data-shy-copy-guard>(function(){var C=[0x00AD,0x200B,0x200C,0x200D,0x2060,0xFEFF];var s=function(t){for(var i=0;i<C.length;i++){t=t.split(String.fromCharCode(C[i])).join("");}return t;};document.addEventListener("copy",function(e){var sel=document.getSelection();if(!sel||sel.isCollapsed||!e.clipboardData){return;}e.clipboardData.setData("text/plain",s(sel.toString()));try{var d=document.createElement("div");d.appendChild(sel.getRangeAt(0).cloneContents());e.clipboardData.setData("text/html",s(d.innerHTML));}catch(x){}e.preventDefault();});})();</script></body>
</html>
```

Tip In our article on [responsive web design and fonts](https://www.ionos.co.uk/digitalguide/websites/web-design/responsive-design-and-font-typography-tips/), we take a closer look at the functionality and advantages of web fonts.

## Which tags are available for using HTML fonts?

There are two [HTML tags](https://www.ionos.co.uk/digitalguide/websites/web-development/html-tags/) that can be used for fonts on web pages: `<font>` and `<basefont>`. However, since the introduction of [HTML5](https://www.ionos.co.uk/digitalguide/websites/web-development/what-is-html5/), both tags are considered outdated. It’s now recommended to manage fonts using [CSS](https://www.ionos.co.uk/digitalguide/websites/web-design/css-coding-made-easy/).

### `<font>`

The tag `<font>` is used to select and define HTML fonts. You can use various [HTML attributes](https://www.ionos.co.uk/digitalguide/websites/web-development/html-attributes/) to define the colour, size and font. These are the attributes and their permitted values:

<table>
  <thead>
    <tr>
      <th>Attribute</th>
      <th>Value</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>`color`</td>
      <td>Colour name, hex color code, or [RGB values](https://www.ionos.co.uk/digitalguide/websites/web-design/rgb-colour/)</td>
      <td>Specifies the colour of the text</td>
    </tr>
    <tr>
      <td>`size`</td>
      <td>Numeric value from 1 to 7</td>
      <td>Defines the size of the HTML fonts</td>
    </tr>
    <tr>
      <td>`face`</td>
      <td>Name of the HTML fonts</td>
      <td>Specifies the desired HTML font family</td>
    </tr>
  </tbody>
</table>

The syntax of `<font>` is as follows:

```html
<font size=" " color=" " face=" "> ....</font>
```

The following code example shows the use of the tag:

```html

<html>
<head>
<title>HTML font tag</title>
</head>
<body>
<font size="3" color="0000FF" face="arial, sans-serif">
This is an example text.
</font>
<div class="hash d-none" hidden>hash_7b53c346525db4f9fa10cb7e453582d4b9132ce0</div><script data-shy-copy-guard>(function(){var C=[0x00AD,0x200B,0x200C,0x200D,0x2060,0xFEFF];var s=function(t){for(var i=0;i<C.length;i++){t=t.split(String.fromCharCode(C[i])).join("");}return t;};document.addEventListener("copy",function(e){var sel=document.getSelection();if(!sel||sel.isCollapsed||!e.clipboardData){return;}e.clipboardData.setData("text/plain",s(sel.toString()));try{var d=document.createElement("div");d.appendChild(sel.getRangeAt(0).cloneContents());e.clipboardData.setData("text/html",s(d.innerHTML));}catch(x){}e.preventDefault();});})();</script></body>
</html>
```

### `<basefont>`

The `<basefont>` tag operates similarly. It sets the HTML font family and its specifications for the entire document. Its attributes are identical to those of the `<font>` tag. The syntax is:

```html
<basefont size=" " color=" " face=" "> ....</font>
```

The following example illustrates font markup with the &lt;basefont&gt;`tag:`

```html

<html>
<head>
<title>HTML font tag</title>
</head>
<body>
<basefont size="3" color="0000FF" face="arial, sans-serif">
This is an example text.
</font>
<div class="hash d-none" hidden>hash_7b53c346525db4f9fa10cb7e453582d4b9132ce0</div><script data-shy-copy-guard>(function(){var C=[0x00AD,0x200B,0x200C,0x200D,0x2060,0xFEFF];var s=function(t){for(var i=0;i<C.length;i++){t=t.split(String.fromCharCode(C[i])).join("");}return t;};document.addEventListener("copy",function(e){var sel=document.getSelection();if(!sel||sel.isCollapsed||!e.clipboardData){return;}e.clipboardData.setData("text/plain",s(sel.toString()));try{var d=document.createElement("div");d.appendChild(sel.getRangeAt(0).cloneContents());e.clipboardData.setData("text/html",s(d.innerHTML));}catch(x){}e.preventDefault();});})();</script></body>
</html>
```

## How to specify font size, font colour and HTML fonts family

Since the introduction of HTML5, the two tags mentioned above have fallen **out of use**. However, it’s still possible to define HTML fonts according to your preferences. For example, here’s how to set font sizes in HTML:

```html

<html>
<head>
<title>Font size</title>
</head>
<body>
<font size = "1">The font size is = "1"</font><br />
<font size = "2">The font size is = "2"</font><br />
<font size = "3">The font size is = "3"</font><br />
<font size = "4">The font size is = "4"</font><br />
<font size = "5">The font size is = "5"</font><br />
<font size = "6">The font size is = "6"</font><br />
<font size = "7">The font size is = "7"</font>
<div class="hash d-none" hidden>hash_7b53c346525db4f9fa10cb7e453582d4b9132ce0</div><script data-shy-copy-guard>(function(){var C=[0x00AD,0x200B,0x200C,0x200D,0x2060,0xFEFF];var s=function(t){for(var i=0;i<C.length;i++){t=t.split(String.fromCharCode(C[i])).join("");}return t;};document.addEventListener("copy",function(e){var sel=document.getSelection();if(!sel||sel.isCollapsed||!e.clipboardData){return;}e.clipboardData.setData("text/plain",s(sel.toString()));try{var d=document.createElement("div");d.appendChild(sel.getRangeAt(0).cloneContents());e.clipboardData.setData("text/html",s(d.innerHTML));}catch(x){}e.preventDefault();});})();</script></body>
</html>
```

Here’s how to specify font colour:

```html

<html>
<head>
<title>Font colour</title>
</head>
<body>
<font color = "#008080">This text is petrol.</font><br />
<font color = "#8B0000">This text is dark red.</font>
<div class="hash d-none" hidden>hash_7b53c346525db4f9fa10cb7e453582d4b9132ce0</div><script data-shy-copy-guard>(function(){var C=[0x00AD,0x200B,0x200C,0x200D,0x2060,0xFEFF];var s=function(t){for(var i=0;i<C.length;i++){t=t.split(String.fromCharCode(C[i])).join("");}return t;};document.addEventListener("copy",function(e){var sel=document.getSelection();if(!sel||sel.isCollapsed||!e.clipboardData){return;}e.clipboardData.setData("text/plain",s(sel.toString()));try{var d=document.createElement("div");d.appendChild(sel.getRangeAt(0).cloneContents());e.clipboardData.setData("text/html",s(d.innerHTML));}catch(x){}e.preventDefault();});})();</script></body>
</html>
```

Here’s how to select an HTML fonts family:

```html

<html>
<head>
<title>HTML fonts family</title>
</head>
<body>
<font face = "Lucida Console" size = "5">Lucida Console</font><br />
<div class="hash d-none" hidden>hash_7b53c346525db4f9fa10cb7e453582d4b9132ce0</div><script data-shy-copy-guard>(function(){var C=[0x00AD,0x200B,0x200C,0x200D,0x2060,0xFEFF];var s=function(t){for(var i=0;i<C.length;i++){t=t.split(String.fromCharCode(C[i])).join("");}return t;};document.addEventListener("copy",function(e){var sel=document.getSelection();if(!sel||sel.isCollapsed||!e.clipboardData){return;}e.clipboardData.setData("text/plain",s(sel.toString()));try{var d=document.createElement("div");d.appendChild(sel.getRangeAt(0).cloneContents());e.clipboardData.setData("text/html",s(d.innerHTML));}catch(x){}e.preventDefault();});})();</script></body>
</html>
```

If a website visitor does not have the specified HTML font family installed, a default font will be displayed instead.


This is a markdown version of: [https://www.ionos.co.uk/digitalguide/websites/web-development/html-fonts/](https://www.ionos.co.uk/digitalguide/websites/web-development/html-fonts/) for AI/LLM consumption.