How To Set Your Font In Html

Table of contents:

How To Set Your Font In Html
How To Set Your Font In Html

Video: How To Set Your Font In Html

Video: How To Set Your Font In Html
Video: 10: How to Import New Fonts | Basics of CSS | Learn HTML and CSS | HTML Tutorial 2024, November
Anonim

Font is an integral part of web design, giving the site a distinctive style. High-quality text on the page should look harmonious, be combined with the rest of the site's elements and at the same time contribute to a better perception of information. Using HTML markup and CSS cascading tables, you can customize almost any setting to maximize page performance.

How to set your font in html
How to set your font in html

Necessary

font file in TTF format

Instructions

Step 1

To use a set of fonts installed on your computer, you can use the font-family parameter of the cascading style sheets. To do this, enter the following code for the desired item:

Text

This command will display the second level h2 heading in the Arial typeface.

Step 2

If you want to use your own font, you must first upload it to the hosting and enable it using the appropriate command. TTF files are included with the following command:

The font-family attribute in this case specifies the name of the font typeface, and src: url (font.ttf) specifies the path to the TTF file.

Step 3

After enabling the element, you can use it to display text:

Text

This command is responsible for displaying the required font font in italics in the heading of the second level. If the user's browser does not support handling TTF files, the system font specified after the first comma (in this case, Verdana) will be used.

Step 4

Some browsers do not support downloadable TTF. For example, Internet Explorer 8 uses the EOT format to display text. For such browsers, convert the original TTF using multiple services and include the resulting typeface in the @ font-face parameter in the same way.

Step 5

If you want to import the file you need from another resource, use the @import command, which must be written at the top of the CSS document:

@import url (https:// font_address)

Recommended: