语法
border-right-color: color | transparent | initial | inherit;
border-right-color 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> div { width: 300px; padding: 20px; border-style: solid; border-color: #ccc; border-right-color: #1c87c9; } </style> </head> <body> <h2>Border-right-color 示例</h2> <div>设置右边框颜色示例</div> </body> </html>
具有“透明”值的 border-right-color 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> h2 { padding: 3px; text-align: center; border: 15px groove #1c87c9; border-right-color: transparent; } </style> </head> <body> <h2>将右边框设置为透明</h2> </body> </html>
我们可以将十六进制、RGB、RGBA、HSL、HSLA 或者颜色名称设置为 border-right-color 属性的值。
具有命名颜色的 border-right-color 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> div { padding: 3px; border-right-style: solid; border-right-color: black; } </style> </head> <body> <div>使用颜色名称来设置</div> </body> </html>
带有十六进制值的 border-right-color 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> div { padding: 3px; border-right-style: solid; border-right-color: #1c87c9; } </style> </head> <body> <div>使用16进制颜色值来设置</div> </body> </html>
带有 RGB 值的 border-right-color 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> div { padding: 3px; border-right-style: solid; border-right-color: rgb(142, 191, 66); } </style> </head> <body> <div>使用rgb颜色值来设置</div> </body> </html>
带有 HSL 值的 border-right-color 属性示例:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> div { padding: 3px; border-right-style: solid; border-right-color: hsl(89, 43%, 51%); } </style> </head> <body> <div>使用hsl颜色值来设置</div> </body> </html>
border-right-color 属性定义了元素右边框的颜色。
右边框颜色与顶部、右侧和底部边框颜色相结合,也可以使用 border-color 速记属性来定义。
如果使用 border-right-color 属性,则应先设置 border-style 或者 border-right-style 属性,然后更改定义样式的颜色。
边框的默认宽度为中等。
我们可以使用 border-width 或者 border-right-width 属性指定宽度。
初始值 | 当前颜色 |
---|---|
应用于 | 所有元素。它也适用于::first-letter。 |
继承 | 不可继承 |
可动画的 | 对。左边框的颜色可以设置动画。 |
版本 | CSS1 |
DOM 语法 | object.style.borderRightColor=“black”; |
CSS border-right-color 属性值说明
值 | 说明 |
---|---|
color | 定义右边框的颜色。默认颜色是当前元素的颜色。可以使用颜色名称、十六进制颜色代码、rgb()、rgba()、hsl()、hsla()。必需值。 |
transparent | 将透明颜色应用于右边框。右边框仍将占用边框宽度值定义的空间。 |
initial | 将属性设置为其默认值。 |
inherit | 从父元素继承属性。 |
日期:2020-06-02 22:14:19 来源:oir作者:oir