CSS font property

CSS font property

Description

The font property is a shorthand property used to affect the rendering of text.

Possible values

The possible values ​​depend on how we use this property.

  • <font-style> – For the font-style property, any of the allowed values ​​are possible.

  • <font-variant> – For the font-variant property, any allowed value is acceptable.

  • <font-weight> – For the font-weight property, any allowed value is acceptable.

  • <font-size> – For the font-size property, any allowed value is acceptable.

  • <font-family> – For the font-family property, any allowed value is acceptable.

  • <line-height> – For the line-height property, any allowed value is acceptable.

  • caption – The font used by the operating system for captioned controls, such as buttons and drop-down menus. This is one of the “system font” values.

  • icon – The font used by the operating system to mark icons. This is one of the “system font” values.

  • menu – The font used by the operating system for menus (such as drop-down menus and menu lists). This is one of the “system font” values.

  • message-box – The font used by the operating system for dialog boxes (such as alert dialog boxes). This is one of the “system font” values.

  • small-caption – The font used by the operating system for small controls. This is one of the “system font” values.

  • status-bar – The font used by the operating system for the window status bar. This is one of the “system font” values.

Applies to

All HTML elements.

DOM Syntax

object.style.font = "bold italic small-caps 250%/1.2 sans-serif"; 

Example

This is an example of using the abbreviated font property –

<html> 
<head> 
</head> 

<body> 
<p style = "font:italic small-caps bold 15px georgia;"> 
Applying all the properties on the text at once. 
</p> 
</body> 
</html> 

This will produce the following result −

CSS font properties

Leave a Reply

Your email address will not be published. Required fields are marked *