CSS | stroke-linejoin Property

The stroke-linejoin property is an inbuilt property used to define the shape that is used to end an open sub-path of a stroke.

Syntax:

stroke-linejoin: miter | miter-clip | round | bevel | arcs | initial | inherit

Property Values:

  • miter: It is used to indicate that a sharp corner would be used to join the two ends. The outer edges of the stroke are extended to the tangents of the path segments until they intersect. This gives the ending a sharp corner.

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <title>
            CSS | stroke-linejoin property
        </title>
        <style>
            .stroke1 {
                stroke-linejoin: miter;
                stroke-width: 20px;
                stroke: green;
                fill: none;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1 style="color: green">
                GeeksforGeeks
            </h1>
            <b>
                CSS | stroke-linejoin: miter;
            </b>
            <div class="container">
                <svg width="400px"
                     height="200px" 
                     xmlns="http://www.w3.org/2000/svg"
                     version="1.1">
                    <rect x="153" y="25" 
                          width="100" 
                          height="100" 
                          class="stroke1" />
                </svg>
            </div>
        </center>
    </body>
      
    </html>

    chevron_right

    
    

    Output:
    miter

  • miter-clip: It is used to indicate that a sharp corner would be used to join the two ends. The outer edges of the stroke are extended to the tangents of the path segments until they intersect.

    It gives the ending a sharp corner like the miter value except another property. The stroke-miterlimit is used to determine whether the miter would be clipped if it exceeds a certain value. It is used to provide a better-looking miter on very sharp joins or animations.



    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <title>
            CSS | stroke-linejoin property
        </title>
        <style>
            .stroke1 {
                stroke-linejoin: miter-clip;
                
                /* setting a lower miterlimit */
                stroke-miterlimit: 1;
                stroke-width: 20px;
                stroke: green;
                fill: none;
            }
              
            .stroke2 {
                stroke-linejoin: miter-clip;
                
                /* setting a higher miterlimit */
                stroke-miterlimit: 2;
                stroke-width: 20px;
                stroke: green;
                fill: none;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1 style="color: green">
                GeeksforGeeks
            </h1>
      
            <b>
                CSS | stroke-linejoin: miter-clip;
            </b>
            <div class="container">
                <svg width="400px" 
                     height="200px" 
                     xmlns="http://www.w3.org/2000/svg" 
                     version="1.1">
                    <rect x="80" y="25" 
                          width="100" 
                          height="100" 
                          class="stroke1" />
                    <rect x="220" y="25"
                          width="100" 
                          height="100" 
                          class="stroke2" />
                </svg>
            </div>
        </center>
    </body>
      
    </html>

    chevron_right

    
    

    Output:

  • round: It is used to indicate that rounded the corner would be used to join the two ends.

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <title>
            CSS | stroke-linejoin property
        </title>
        <style>
            .stroke1 {
                stroke-linejoin: round;
                stroke-width: 20px;
                stroke: green;
                fill: none;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1 style="color: green">
                GeeksforGeeks
            </h1>
            <b>
                CSS | stroke-linejoin: round;
            </b>
            <div class="container">
                <svg width="400px" 
                     height="200px" 
                     xmlns="http://www.w3.org/2000/svg" 
                     version="1.1">
                    <rect x="153" y="25" 
                          width="100" 
                          height="100" 
                          class="stroke1" />
                </svg>
            </div>
        </center>
    </body>
      
    </html>

    chevron_right

    
    

    Output:
    round

  • bevel: It is used to indicate that the connecting point is cropped perpendicular to the joint.

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
    <head>
        <title>
            CSS | stroke-linejoin property
        </title>
        <style>
            .stroke1 {
                stroke-linejoin: bevel;
                stroke-width: 20px;
                stroke: green;
                fill: none;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1 style="color: green">
                GeeksforGeeks
            </h1>
      
            <b>CSS | stroke-linejoin: bevel;</b>
      
            <div class="container">
                <svg width="400px" height="200px" 
                     xmlns="http://www.w3.org/2000/svg" 
                     version="1.1">
                    <rect x="152" y="25" 
                          width="100" 
                          height="100" 
                          class="stroke1" />
                </svg>
            </div>
        </center>
    </body>
      
    </html>

    chevron_right

    
    

    Output:
    bevel

  • arcs: It is used to indicate that an arcs corner is to be used to join path segments. This shape is formed by the extension of the outer edges of the stroke having the same curvature as the outer edges at the point they join.
  • initial: It is used to set the property to its default value.

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
      
    <head>
        <title>
            CSS | stroke-linejoin
        </title>
        <style>
            .stroke1 {
                stroke-linejoin: initial;
                stroke-width: 20px;
                stroke: green;
                fill: none;
            }
        </style>
    </head>
      
    <body>
        <center>
            <h1 style="color: green">
                GeeksforGeeks
            </h1>
            <b>
                CSS | stroke-linejoin: initial;
            </b>
            <div class="container">
                <svg width="400px" 
                     height="200px" 
                     xmlns="http://www.w3.org/2000/svg"
                     version="1.1">
                    <rect x="153" y="25" 
                          width="100"
                          height="100"
                          class="stroke1" />
                </svg>
            </div>
        </center>
    </body>
      
    </html>

    chevron_right

    
    

    Output:
    initial

  • inherit: It is used to set the property to inherit from its parent.

Supported Browsers: The browser supported by stroke-linejoin property are listed below:

  • Chrome
  • Internet Explorer 9
  • Firefox
  • Safari
  • Opera

Note: The stroke-linejoin: arcs; is not supported by any major browsers.




My Personal Notes arrow_drop_up

Im listening

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.


Article Tags :

Be the First to upvote.


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