CSS border-color property

CSS border-color Property

Description

The border-color property allows you to change the color of the border around an element. You can use the following properties to individually change the color of the bottom, left, top, and right sides of an element’s border:

object.style.borderColor = "red";

Example

Here’s an example showing the effects of all of these properties –

<html>
<head>
<style type = "text/css"> 
p.example1 { 
border:1px solid; 
border-bottom-color:#009900; /* Green */ 
border-top-color:#FF0000; /* Red */ 
border-left-color:#330000; /* Black */ 
border-right-color:#0000CC; /* Blue */ 
} 
p.example2 { 
border:1px solid; 
border-color:#009900; /* Green */ 
} 
</style> 
</head> 

<body> 
<p class = "example1"> 
This example is showing all borders in different colors. 
</p> 

<p class = "example2"> 
This example is showing all borders in green color only. 
</p> 
</body> 
</html> 

This will produce the following result−


CSS border-color property

Leave a Reply

Your email address will not be published. Required fields are marked *