Sunday, April 20, 2025

CSS Border Color Mix

The color of borders can be set using the border-color property. The border-color property can take up to four values to specify the color of the top, right, bottom, and left borders respectively. Alternatively, the border-top-color, border-right-color, border-bottom-color, and border-left-color properties can be used to specify the color of each border separately.

Colors can be specified using different formats, such as named colors (red, blue, green, etc.), hexadecimal codes (#ff0000, #00ff00, #0000ff, etc.), or RGB values (rgb(255, 0, 0), rgb(0, 255, 0), rgb(0, 0, 255), etc.). 


<!DOCTYPE html>

<html>
<head><title>Title</title></head>

<link rel="stylesheet" type="text/css" href="mystyle.css">

<body>

<p>Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, sed do eiusmod tempor 
incididunt ut labore et dolore magna aliqua. Ut enim ad 
minim veniam.</p>

</body>
</html>

Our simple html example. 


p {
	border-style: solid;
	border-width: 15px;
	
	border-color: red;
}

The above CSS code will add a solid border with a width of 15 pixels and red color to all p elements on the webpage. 


p {
	border-style: solid;
	border-width: 15px;
	
	border-color: red;
	border-left-color: blue;
}

The CSS code applies a solid border style to the paragraphs (<p> tags) with a width of 15 pixels and a color of red. It also sets the left border color to blue, which means the left side of the border will be blue while the other three sides will be red. 


p {
	border-style: solid;
	border-width: 15px;
	
	border-left-color: blue;
	border-right-color: yellow;
	border-top-color: orangered;
	border-bottom-color: green;
}

This CSS code sets a solid border style for the paragraph (p) element with a width of 15 pixels. It also sets different border colors for each side of the element, with blue for the left side, yellow for the right side, orangered for the top side, and green for the bottom side.

This will result in a paragraph element with a 15 pixel solid border, where each side of the border has a different color. 


p {
	border-width: 15px;
	
	border-left-color: blue;
	border-right-color: yellow;
	border-top-color: orangered;
	border-bottom-color: green;
	
	border-left-style: dashed;
	border-right-style: double;
	border-top-style: ridge;
	border-bottom-style: solid;
}

This CSS code sets a border around p elements with a width of 15 pixels and different colors for each side. The left side has a blue color, the right side has a yellow color, the top side has an orangered color, and the bottom side has a green color.

Additionally, this code sets different styles for each side of the border. The left side has a dashed style, the right side has a double style, the top side has a ridge style, and the bottom side has a solid style.

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...