CSS | font-style Property

In CSS, if we want to give designing to any type of text then we can make the use of CSS font style attribute. It helps to make the better user experience.

Syntax:

font-style: normal|italic|oblique|initial|inherit;
  • Normal font-style property:

    Syntax:

    font-style: normal;

    Example:



    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            p.a {
                font-style: normal;
            }
        </style>
    </head>
      
    <body>
        <h1>Normal font-style Property</h1>
      
        <p class="a">GeeksforGeeks</p>
    </body>
      
    </html>

    chevron_right

    
    

    Output

  • Italic font-style property

    Syntax:

    font-style: italic;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            p.a {
                font-style: italic;
            }
        </style>
    </head>
      
    <body>
        <h1>Italic font-style Property</h1>
      
        <p class="a">GeeksforGeeks</p>
    </body>
      
    </html>

    chevron_right

    
    

    Output

  • Oblique font-style property

    Syntax:

    font-style: oblique;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            p.a {
                font-style: oblique;
            }
        </style>
    </head>
      
    <body>
        <h1>Oblique font-style Property</h1>
      
        <p class="a">GeeksforGeeks</p>
    </body>
      
    </html>

    chevron_right

    
    

    Output

  • Initial font-style property:

    Syntax:

    font-style: initial;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            p.a {
                font-style: initial;
            }
        </style>
    </head>
      
    <body>
        <h1>Initial font-style Property</h1>
      
        <p class="a">GeeksforGeeks</p>
    </body>
      
    </html>

    chevron_right

    
    

    Output

  • Inherit font-style property:

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!-- Write HTML code here -->
    <!DOCTYPE html>
    <html>
      
    <head>
        <style>
            span {
                color: blue;
                font-size: 70px;
            }
              
            .extra span {
                color: inherit;
            }
        </style>
    </head>
      
    <body>
      
        <div>
            <span>GeeksforGeeks</span>
        </div>
      
        <div class="extra" style="color:green">
            <span>GeeksforGeeks</span>
        </div>
      
        <div style="color:red">
            <span>GeeksforGeeks</span>
        </div>
      
    </body>
      
    </html>

    chevron_right

    
    

    Output



  • 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.