Advertisement
Google Ad Slot: content-top
CSS Border
In CSS, the border property allows you to define the appearance of an element's border. You can customize its color, style, and width, among other properties.
Syntax:
border: <width> <style> <color>;
Width: Thickness of the border (e.g., 1px, 2em, etc.).
Style: The type of border (e.g., solid, dashed, dotted, etc.).
Color: The color of the border (e.g., red, #3498db, rgb(52, 152, 219)).
Border Width:
You can specify the width of the border in various units (px, em, %, etc.). You can also use keywords like thin, medium, or thick.
Syntax:
border-width: value | thin | medium | thick;
Hello World!
This page has a light blue border color!
Border Styles:
The border-style property specifies the style of the borders.
Syntax:
border-style: solid | dashed | dotted | double | groove | ridge | inset | outset | none;
Border Color:
You can specify the color of the border using color names, hexadecimal values, RGB, RGBA, HSL, etc.
Syntax:
border-style: names | hexadecimal values | RGB | RGBA | HSL;
Individual Border Sides:
You can define borders for individual sides using the following properties:
border-topborder-rightborder-bottomborder-left
Shorthand for Individual Sides:
You can also use shorthand notation for specifying the width, style, and color of borders for individual sides.
Border Radius (Rounded Corners):
You can use the border-radius property to create rounded corners. This can be applied uniformly to all corners or individually.