CSS border-top
The border-top property in CSS is used to set the style, width, and color of the top border of an element. This property is part of the border shorthand property, which allows you to set all the border properties (top, right, bottom, and left) in one declaration.
The syntax for the border-top property is as follows:
border-top: border-width border-style border-color;
Where:
border-width: Specifies the width of the border. It can be set in pixels, ems, rems, or any other valid unit of measurement.border-style: Specifies the style of the border (e.g., solid, dashed, dotted).border-color: Specifies the color of the border. It can be set as a named color (e.g., red, blue) or using hex codes (#ff0000, #00ff00).
Let's see an example below:
In the example above, we set the border-top property to 2px solid #ff0000. This creates a top border with a width of 2 pixels, a solid style, and a red color. The content within the div element has a padding of 10 pixels to better display the border.