HTML | DOM Style borderRightColor Property
The borderRightColor property allows us to set/get the color to right border of element.
Syntax:
- It is used to return the borderRightColor property.
object.style.borderRightColor
- It is used to set the borderRightColor property.
object.style.borderRightColor = "color|transparent|initial|inherit"
Return Value:The borderRightColor property returns the color of the right border of an element.
Property Values:
- color:It specifies the right border color of corresponding element. Black is default color.
Syntax:
borderRightColor = "red"
Example:
HTML
<!DOCTYPE html> < html > < head > < style > #GFG_Div { width: 200px; margin-left: 210px; border: thick solid green; } </ style > </ head > < body align = "center" > < p > Click to change the right border color of element.</ p > < button type = "button" onclick = "myGeeks()" > Click to change </ button > < br > < br > < div id = "GFG_Div" >GeeksforGeeks</ div > < script > function myGeeks() { document.getElementById("GFG_Div") .style.borderRightColor = "red"; } </ script > </ body > </ html > |
Output:
- Before Click on button
- After Click on Button
Syntax:
borderRightColor = "yellow"
Example:
HTML
<!DOCTYPE html> < html > < head > < style > #GFG_Div { width: 200px; margin-left: 210px; border: thick solid green; } </ style > </ head > < body align = "center" > < p > Click to change the right border color of element.</ p > < button type = "button" onclick = "myGeeks()" > Click to change </ button > < br > < br > < div id = "GFG_Div" >GeeksforGeeks</ div > < script > function myGeeks() { document.getElementById("GFG_Div") .style.borderRightColor = "yellow"; } </ script > </ body > </ html > |
Output:
- Before Click on button
- After Click on Button
- transparent:It sets the right border color of corresponding element to transparent.
Syntax:
borderRightColor = "transparent"
Example:
HTML
<!DOCTYPE html> < html > < head > < style > #GFG_Div { width: 200px; margin-left: 210px; border: thick solid green; } </ style > </ head > < body align = "center" > < p > Click to change the right border color of element.</ p > < button type = "button" onclick = "myGeeks()" > Click to change </ button > < br > < br > < div id = "GFG_Div" >GeeksforGeeks</ div > < script > function myGeeks() { document.getElementById("GFG_Div") .style.borderRightColor = "transparent"; } </ script > </ body > </ html > |
Output:
- Before Click on button
- After Click on Button
- initial:When no value specified for this field, it is inherited from the parent of element. If there is no parent means this element is root then it takes initial(or default) value.
- inherit:This keyword applies the initial(or default) value of a property to an element. The initial value should not be confused by the value specified by the browser’s style sheet. When borderColor sets to initial, It appears black(default) color.
Browser Support: The browser supported by DOM Style borderRightColor property are listed below:
- Google Chrome: Supported
- Internet Explorer: Supported
- Mozilla firefox: Supported
- Safari: Supported
- Opera: Supported
Please Login to comment...