HTML: change font - how it works
In HTML, you can change the font with a simple tag. We'll explain how, but also why CSS is the better choice.
Change font to HTML
In HTML there is the so-called font tag. With this tag you can set the font, font size or color of a text.
- For example, it could look like this: Hello, I am Arial !.
- In the screenshot you can see the result of the code line under the heading "HTML". Another example in "Monospace".
- However, the tag is out of date and is no longer supported in HTML5. You should therefore use CSS or inline CSS as in the example.
- In this case, the tag should be structured as follows:
Hello, I am Arial!
, - Behind the word "style" you can insert CSS code in an HTML tag. You set the font here with "font-family".
- As you can see, this day leads to the same result, but you are future-proof with this method.
We also explain how you can set the line spacing using CSS.