How to set the font in html

How to set the font in html

Font – the integral part of web-design giving to the website characteristic style. The qualitative text on the page should look harmoniously, be combined with other elements of the website and at the same time promote the best perception of information. By means of a markup language of HTML and the cascade tables CSS it is possible to configure practically any settings promoting achievement of maximum efficiency of the page.

It is required to you

  • - file of a font in the TTF format.

Instruction

1. For use of set of font installed on the computer it is possible to use the font-family parameter of cascading style sheets. For this purpose enter the following code for the necessary element:

Text



This command will display heading of the second h2 level the text of the Arial headset.

2. If you want to use own font, it needs previously to be loaded on a hosting and to include by means of the corresponding command. The TTF files join the following command:

>
@font-face { font-family: font;
src: url(font.ttf); }


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

3. After inclusion of an element it is possible to use it for display of the text:

Text



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

4. Some browsers do not support the loaded TTF. For example, Internet Explorer 8 for display of the text uses the EOT format. For such observers convert initial TTF through numerous services and turn on the received headset in the @font-face parameter the same way.

5. If you want to import the file necessary to you from other resource, use the @import command which needs to be registered at the top of the document CSS:

@import url (http://адрес_шрифта)

Author: «MirrorInfo» Dream Team


Print