CSS Basic Tutorial
CSS Flexbox
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.
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)
).
You can specify the width of the border in various units (px
, em
, %
, etc.). You can also use keywords like thin
, medium
, or thick
.
border-width: value | thin | medium | thick;
This page has a light blue border color!
The border-style
property specifies the style of the borders.
border-style: solid | dashed | dotted | double | groove | ridge | inset | outset | none;
Try it yourself
You can specify the color of the border using color names, hexadecimal values, RGB, RGBA, HSL, etc.
border-style: names | hexadecimal values | RGB | RGBA | HSL;
You can define borders for individual sides using the following properties:
border-top
border-right
border-bottom
border-left
Try it yourself
You can also use shorthand notation for specifying the width, style, and color of borders for individual sides.
Try it yourself
You can use the border-radius
property to create rounded corners. This can be applied uniformly to all corners or individually.
Try it yourself