Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 Class 7 Class 8

Basic Font Styles in HTML

Share Now

Basic font styles in HTML are used to change the appearance of text on a web page. These styles include making text bold, italic, underlined, or changing its size, color, and font family.

Basic Font Styles in HTML

The fonts in HTML are used to control the appearance of the text, such as style, size, colour and thickness. Nowadays fonts in HTML are not used in modern HTML programs. Modern methods use CSS to give style, size, colour and thickness to the text.

Syntax:

<font size="4" color="red" face="Arial" >Hello World</font>

Font attributes in HTML

font attribute in  html

font-family

The font-family defines the style of the text, meaning how the text appearance will be.

<p style="font-family: Arial, Verdana, sans-serif;">
This text uses Arial. If Arial isn’t available, it will try Verdana, then a generic sans-serif font.
</p>

font-size

The font size is used to define the size of the text; this size you can define using px, em, % or rem.

<p style="font-size: 20px;" >
This text is 20 pixels in size.
</p>

colour

The font colour is used to change the colour of the text; this colour can be defined using a colour name or hex codes or using RGB.

<p style="color: blue;">
This text is blue.
</p>

font-weight

The font-weight controls how the text will appear; the value of the font-weight will be normal, bold or numeric.

<p style="font-weight: bold;">
This text is bold.
</p>

<p style="font-weight: 300;" >
This text is light (thin).
</p>

font-style

The font style is used to control the text as italic or normal text.

<p style="font-style: italic;">
This text is italic.
</p>

<p style="font-style: normal;">
This text is normal.
</p>

Disclaimer: We have provide you with the accurate handout of β€œBasic Font Styles in HTMLβ€œ. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above study material present on our websites is for education purpose, not our copyrights.

Images and content shown above are the property of individual organisations and are used here for reference purposes only. To make it easy to understand, some of the content and images are generated by AI and cross-checked by the teachers.

cbseskilleducation.com

Leave a Comment