Set the font variant with CSS

The CSS font-variant property controls how text is displayed, allowing you to transform lowercase letters into small capital letters or display text normally.

Syntax

font-variant: normal | small-caps | inherit;

Parameters

Value Description
normal Default value. Text displays normally
small-caps Converts lowercase letters to small capital letters
inherit Inherits the font-variant from parent element

Example: Using small-caps

<html>
   <head>
      <style>
         .small-caps {
            font-variant: small-caps;
         }
         .normal {
            font-variant: normal;
         }
      </style>
   </head>
   
   <body>
      <p class="small-caps">
         This text will be rendered as small caps
      </p>
      <p class="normal">
         This text displays normally
      </p>
   </body>
</html>

Example: Inline Styling

<html>
   <head>
   </head>
   
   <body>
      <p style="font-variant: small-caps;">
         This text will be rendered as small caps
      </p>
      <p style="font-variant: normal;">
         This text displays with normal font variant
      </p>
   </body>
</html>

Comparison

Value Effect on "Hello World" Use Case
normal Hello World Default text display
small-caps HELLO WORLD (but H and W are larger) Headings, emphasis, formal documents

Conclusion

The font-variant property provides an elegant way to display text in small capitals. Use small-caps for formal styling and normal for standard text display.

Updated on: 2026-03-15T23:18:59+05:30

131 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements