当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


CSS border-right-width用法及代码示例


CSS中的border-right-width属性用于设置元素的right-border的宽度。必须在border-right-width属性之前声明border-style属性或border-right-style属性。

用法:

border-right-width:medium|thin|thick|length|initial|inherit; 

属性值:
medium:它是默认值。用于指定中等大小的right-border。


  • 用法:
    border-right-width:medium;
  • Example:
    <!DOCTYPE html>  
    <html>  
        <head>  
            <title> 
                CSS | border-right-width Property 
            </title> 
            <style>  
                h3 {  
                    border:solid green;  
                    border-right-width:medium;  
                    width:50%;  
                }  
                p { 
                    border-style:dotted; 
                    border-right-width:medium; 
                    width:70%; 
                } 
            </style>  
        </head>  
          
        <body>  
            <center>  
                <h1 style = "color:green"> 
                 GeeksForGeeks 
                </h1>  
                <h2>border-right-width:initial;</h2>  
                  
                <!-- border-right-width property  
                                       used here -->
                <h3>GeeksForGeeks</h3>  
                  
                <!-- border-right-width property  
                                       used here -->
                <p> 
                 It is a computer science portal for geeks. 
                </p>  
            </center> 
        </body>  
    </html>                    
  • Output:

thin:此属性用于将右边框的宽度设置为Thin。

  • 用法:
    border-right-width:thin;
  • 例:
    <!DOCTYPE html>  
    <html>  
        <head>  
            <title> 
                CSS | border-right-width Property 
            </title> 
            <style>  
                h3 {  
                    border:solid green;  
                    border-right-width:thin;  
                    width:50%;  
                }  
                p { 
                    border-style:dotted;  
                    border-right-width:thin;  
                    width:70%; 
                } 
            </style>  
        </head>  
          
        <body>  
            <center>  
                <h1 style = "color:green"> 
                 GeeksForGeeks 
                </h1>  
                <h2>border-right-width:initial;</h2>  
                  
                <!-- border-right-width property  
                                       used here -->
                <h3>GeeksForGeeks</h3>  
                  
                <!-- border-right-width property  
                                       used here -->
                <p> 
                 It is a computer science portal for geeks. 
                </p>  
            </center>> 
        </body>  
    </html>                    
  • 输出:

厚:此属性用于指定元素的粗right-border。

  • 用法:
    border-right-width:thick;
  • 例:
    <!DOCTYPE html>  
    <html>  
        <head>  
            <title> 
                CSS | border-right-width Property 
            </title> 
            <style>  
                h3 {  
                    border:solid green;  
                    border-right-width:thick;  
                    width:50%;  
                }  
                p { 
                    border-style:dotted;  
                    border-right-width:thick;  
                    width:70%; 
                } 
            </style>  
        </head>  
          
        <body>  
            <center>  
                <h1 style = "color:green"> 
                 GeeksForGeeks 
                </h1>  
                <h2>border-right-width:initial;</h2>  
                  
                <!-- border-right-width property  
                                       used here -->
                <h3>GeeksForGeeks</h3>  
                  
                <!-- border-right-width property  
                                       used here -->
                <p> 
                 It is a computer science portal for geeks. 
                </p>  
            </center> 
        </body>  
    </html>                    
  • 输出:

长度:此属性用于设置right-border的厚度。

  • 用法:
    border-right-width:length;
  • 例:
    <!DOCTYPE html>  
    <html>  
        <head>  
            <title> 
                CSS | border-right-width Property 
            </title> 
            <style>  
                h3 {  
                    border:solid green;  
                    border-right-width:10px;  
                    width:50%;  
                }  
                p { 
                    border-style:dotted;  
                    border-right-width:5px;  
                    width:70%; 
                } 
            </style>  
        </head>  
          
        <body>  
            <center>  
                <h1 style = "color:green"> 
                 GeeksForGeeks 
                </h1>  
                <h2>border-right-width:initial;</h2>  
                  
                <!-- border-right-width property  
                                       used here -->
                <h3>GeeksForGeeks</h3>  
                  
                <!-- border-right-width property  
                                       used here -->
                <p> 
                 It is a computer science portal for geeks. 
                </p>  
            </center> 
        </body>  
    </html>                    
  • 输出:

initial:用于将border-right-width属性设置为其默认值。

  • 用法:
    border-right-width:initial;
  • 例:
    <!DOCTYPE html>  
    <html>  
        <head>  
            <title> 
                CSS | border-right-width Property 
            </title> 
            <style>  
                h3 {  
                    border:solid green;  
                    border-right-width:initial;  
                    width:50%;  
                }  
                p { 
                    border-style:dotted;  
                    border-right-width:initial;  
                    width:70%; 
                } 
            </style>  
        </head>  
          
        <body>  
            <center>  
                <h1 style = "color:green"> 
                 GeeksForGeeks 
                </h1>  
                <h2>border-right-width:initial;</h2>  
                  
                <!-- border-right-width property  
                                       used here -->
                <h3>GeeksForGeeks</h3>  
                  
                <!-- border-right-width property  
                                       used here -->
                <p> 
                 It is a computer science portal for geeks. 
                </p>  
            </center> 
        </body>  
    </html>                    
  • 输出:

支持的浏览器:下面列出了border-right-width属性支持的浏览器:

  • 谷歌浏览器1.0
  • Internet Explorer 4.0
  • Firefox 1.0
  • Opera 3.5
  • 苹果Safari 1.0


相关用法


注:本文由纯净天空筛选整理自ManasChhabra2大神的英文原创作品 CSS | border-right-width Property。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。