CSE 154 Examples

Font Size Property

The Font Size property is used to specify the size of the font of the text the style is applied to.

Description

The font-size property can be specified in many ways.

  • Dimension - The size can be specified in any of the following values : xxsmall, xsmall, small, medium, large, xlarge and xxlarge
  • Length - The exact length can be specified in terms of px, pt, em, etc.
  • Percentage - The font-size can be specified as a percentage of the parent element's font size.
  • Syntax :

                      
                          element {
                            font-size: 15pt;
                          }
    
                          p {
                            font-size: small;
                          }
                      
                    

    HTML :

    CSS :

    Live Preview :