CSS: border-right-color property
This CSS tutorial explains how to use the CSS property called border-right-color with syntax and examples.
Description
The CSS border-right-color property defines the color of the right border of a box.
Syntax
The syntax for the border-right-color CSS property is:
border-right-color: value;
Parameters or Arguments
- value
The color of the right border. It can be one of the following:
Value Description #RRGGBB Hexadecimal representation of the border-right-color
div { border-right-color: #000000; }rgb() RGB representation of the border-right-color
div { border-right-color: rgb(0,0,0); }name Name of the border-right-color (ie: red, blue, black, white)
div { border-right-color: black; }transparent Border is not displayed but still takes up space on the page
div { border-right-color: transparent; }inherit Element will inherit the border-right-color from its parent element
div { border-right-color: inherit; }
Note
- Be sure to set the border-right-style property as well to make sure that your right border appears.
- See also border-right-style, border-right-width, and border-right properties.
- Need to convert your color value to a different representation? Try this online tool to convert your color value between hexadecimal and RGB.
Browser Compatibility
The CSS border-right-color property has basic support with the following browsers:
- Chrome
- Android
- Firefox (Gecko)
- Firefox Mobile (Gecko)
- Internet Explorer (IE)
- IE Phone
- Opera
- Opera Mobile
- Safari (WebKit)
- Safari Mobile
Example
We will discuss the border-right-color property below, exploring examples of how to use this property in CSS.
Using Hexadecimal
Let's look at a CSS border-right-color example where we have provided a hexadecimal value for the border-right-color property.
div { border-right-color: #0000FF; border-right-style: solid; }
In this border-right-color example, we have provided a hexadecimal value of #0000FF which would display a blue right border for the <div> tag. Be sure to apply a border-right-style so that the border appears.
Using RGB
We can also provide the border-right-color value using rgb.
div { border-right-color: rgb(0,0,255); border-right-style: solid; }
In this border-right-color example, rgb(0,0,255) would also display the right border for the <div> tag in blue.
Using Color Name
Let's look at a CSS border-right-color example where we have provided the value as a named color.
div { border-right-color: blue; border-right-style: solid; }
In this CSS border-right-color example, we have provided the name "blue" which would also set the right border to blue.
Advertisements