當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。