Simple style options allow you to change the font of a web page with cascading style sheets . Use CSS to set the font for individual words, specific sentences, headings, entire paragraphs, and even entire pages of text.

Illustration of a person changing fonts with CSS code on a computer screen
Lifewire / Derek Abella

How to change the font with CSS

Make changes HTML and CSS described below using any HTML editor or text editor .

  1. Find the text where you want to change the font. We will use this as an example:

    Этот текст в Arial 
  2. Surround the text with a SPAN element:

     Этот текст в Arial 
  3. Add an attribute style=»» in span tag:

     Этот текст находится в Arial 
  4. In the style attribute, change the font using style font-family .

     Этот текст находится в Arial 
    Screenshot of font family options in HTML
    John Fisher
  5. Save your changes to see the effects.

Tips for using CSS to change the font

Похожие записи