Open In App

CSS outline-style Property

The outline-style property in CSS is used to set the appearance of the outline of an element. The outline and border of an element are similar, but not the same. The outline does not take space and it is drawn outside the border of an element. Also, the outline is drawn around all the four sides of the element by default, and there is no way to alter this. 

Syntax:



outline-style: auto|none|dotted|dashed|solid|double|groove|ridge|
inset|outset|initial|inherit;

Property Values:

Syntax:



outline-style: auto;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                  
                /* CSS Property for outline-style */ 
                outline-style: auto;
            }
        </style>
      
    </head>
      
    <body>
        <!-- outline-style: auto;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output:

 

Syntax:

outline-style: none;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                  
                /* CSS Property for outline-style */ 
                outline-style: none;
            }
        </style>
      
    </head>
      
    <body>
          
        <!-- outline-style: none;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output:

 

Syntax:

outline-style: dotted;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                  
                /* CSS Property for outline-style */ 
                outline-style: dotted;
            }
        </style>
      
    </head>
      
    <body>
          
        <!-- outline-style: dotted;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output:

 

Syntax:

outline-style: dashed;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                  
                /* CSS Property for outline-style */ 
                outline-style: dashed;
            }
        </style>
      
    </head>
      
    <body>
          
        <!-- outline-style: dashed;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output:

 

Syntax:

outline-style: solid;

Example: 




<!DOCTYPE html>
<html>
  <head>
    <title>CSS outline-style property</title>
  
    <!-- Internal CSS Style Sheet -->
    <style>
      h1{
        color: green;
        text-align: center;
          
        /* CSS Property for outline-style */ 
        outline-style: solid;
      }
    </style>
  
  </head>
  
  <body>
      <!-- outline-style: solid;-->
      <h1>GeeksForGeeks</h1>
  </body>
  
</html>

Output:

 

Syntax:

outline-style: double;

Example: 




<!DOCTYPE html>
<html>
  <head>
    <title>CSS outline-style property</title>
  
    <!-- Internal CSS Style Sheet -->
    <style>
      h1{
        color: green;
        text-align: center;
          
        /* CSS Property for outline-style */ 
        outline-style: double;
      }
    </style>
  
  </head>
  
  <body>
      <!-- outline-style: double;-->
      <h1>GeeksForGeeks</h1>
  </body>
  
</html>

Output:

 

Syntax:

outline-style: groove;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                outline-width: 8px;
                  
                /* CSS Property for outline-style */ 
                outline-style: groove;
            }
        </style>
      
    </head>
      
    <body>
          
        <!-- outline-style: groove;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output: 

Syntax:

outline-style: ridge;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                outline-width: 8px;
                  
                /* CSS Property for outline-style */ 
                outline-style: ridge;
            }
        </style>
    </head>
      
    <body>
          
        <!-- outline-style: ridge;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output:

 

Syntax:

outline-style: inset;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                outline-width: 8px;
                  
                /* CSS Property for outline-style */ 
                outline-style: inset;
            }
        </style>
    </head>
      
    <body>
          
        <!-- outline-style: inset;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output:

 

Syntax:

outline-style: outset;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                outline-width: 8px;
                  
                /* CSS Property for outline-style */ 
                outline-style: outset;
            }
        </style>
    </head>
      
    <body>
          
        <!-- outline-style: outset;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output: 

Syntax:

outline-style: initial;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            h1 {
                color: green;
                text-align: center;
                outline-width: 5px;
                outline-color: black;
          
                /* CSS Property for outline-style */
                outline-style: initial;
            }
        </style>
    </head>
      
    <body>
          
        <!-- outline-style: initial;-->
        <h1>GeeksForGeeks</h1>
    </body>
  
</html>                    

Output:

 

Syntax:

outline-style: inherit;

Example: 




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS outline-style property
        </title>
      
        <!-- Internal CSS Style Sheet -->
        <style>
            * {
                padding: 1px;
            }
            body {
                outline-style: dashed;
            }
            h1 {
                color: green;
                text-align: center;
                outline-width: 5px;
                outline-color: black;
          
                /* CSS Property for outline-style */
                outline-style: inherit;
            }
        </style>
    </head>
      
    <body>
          
        <!-- outline-style: inherit;-->
        <h1>GeeksForGeeks</h1>
    </body>
</html>                    

Output:

 

Supported Browsers: The browser supported by outline-style property are listed below:


Article Tags :