Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does HTML style fonts?


May 29, 2021 Article blog



When we develop a page, we often involve the text section. H TML default font style is arsequence, 12px. I f we don't want to set the font to arse style, we need to change the style for it. Changes to HTML font styles require CSS.

There are five font properties commonly used by CSS: font-style font-weight font-size font-family font

  • font-style: Set italics. normal is a normal font, italic sets italic italic.

p{font-style:italic}

  • font-weight: Set font weight. normal is normal, bold is font bold, 100-900 is thickness.

p{font-weight:bold;}
p{font-weight:400;}

  • font-size: Set the font size.

p{font-size:24px;}

  • font-family: Set font style, such as Microsoft Yahe, Italic, Song body...

p{font-family:"楷体";}

  • font: At the same time, the font is italicized, bolded, sized, font, separated by a space between each value, and must be executed strictly in order.

p{font:italic bold 24px "楷体";}

That's all that's about how HTML is styled. For more HTML learning, browse the HTML tutorial.