CSS font-variant Property

The font-variant property is used to converted all lowercase letters into uppercase letters. But the converted upper letters appear too small font-size than the original uppercase letters.

Syntax:

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

Property Values:

  • normal: It has a default value. It specifies a normal font-size.

    Syntax:

    font-variant:normal;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            h1 {
                color: green;
            }
              
            p.geeks {
                font-variant: normal;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1>GeeksForGeeks</h1>
            <h2>font-variant:normal;</h2>
            <p class="geeks">GeeksForGeeks.</p>
            <p>It is a computer science portal for geeks.</p>
      
    </body>
      
    </html>

    chevron_right

    
    

    Output :

  • small-caps: It is used to convert all the lowercase letter into a uppercase letters.

    Syntax:

    font-variant:small-caps;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            h1 {
                color: green;
            }
              
            p.geeks {
                font-variant: small-caps;
            }
              
            .gfg {
                font-variant: small-caps;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1>GeeksForGeeks</h1>
            <h2>font-variant:small-caps;</h2>
            <p class="geeks">GeeksForGeeks.</p>
            <p class="gfg">
             It is a computer science 
             portal for geeks.
            </p>
      
    </body>
      
    </html>

    chevron_right

    
    

    Output:

  • initial:It sets the property to its default value.

    Syntax:

    font-variant:initial;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            h1 {
                color: green;
            }
              
            p.geeks {
                font-variant: initial;
            }
              
            .gfg {
                font-variant: initial;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1>GeeksForGeeks</h1>
            <h2>font-variant:initial;</h2>
            <p class="geeks">GeeksForGeeks.</p>
            <p class="gfg">
             It is a computer science
             portal for geeks.
            </p>
      
    </body>
      
    </html>

    chevron_right

    
    

    Output:

Supported Browsers: The browser supported by CSS font-variant property are listed below:

  • Google Chrome 1.0
  • Internet Explorer 4.0
  • Firefox 1.0
  • Opera 3.5
  • Apple Safari 1.0


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : shubham_singh



Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.