Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

CSS | stroke-linejoin Property

  • Last Updated : 22 Nov, 2019

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:




    <!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>

    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:




    <!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>

    Output:

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

    Example:




    <!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>

    Output:
    round

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

    Example:




    <!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>

    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:




    <!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>

    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
Recommended Articles
Page :

Start Your Coding Journey Now!