CSS border-style Property
The border-style CSS property is a shorthand property that sets the line style for all four sides of an element’s border.
Note: The border-style property can take One to Four values at a time.
- none: No border is created and it is left plain.
- hidden: Just like none, it doesn’t show any border unless a background image is added, then the border-top-width will be set to 0 irrespective of the user-defined value.
- dotted: A series of dots are displayed in a line as the border.
- solid: A single solid and bold line is used as a border.
- dashed: A series of square dashed lines are used as a border.
- double: Two lines placed parallel to each other act as the border.
- groove: Displays a 3D grooved border, its effect depends on border-color value.
- ridge: Displays a 3D ridged border, its effect depends on border-color value.
- inset: displays a 3D inset border, its effect depends on border-color value.
- outset: Displays a 3D outset border, its effect depends on border-color value.
The border-style property is a shorthand for the following CSS properties:
- CSS border-bottom-style Property: It s used to set the style of the bottom border of an element.
- CSS border-top-style Property: It is used to specify the style of the top border.
- CSS border-left-style Property: It is used to set the style of the left border of an element.
- CSS border-right-style Property: It is used to change the appearance of the right line segment of the border of an element.
- CSS border-block-style Property: It is used to set the individual logical block border-style property values in a single place in the style sheet.
- CSS border-inline-style Property: It is an inbuilt property in CSS which is used to set the individual logical block inline-border-style property values in a single place in the style sheet.
The border-style property may be defined by using one, two, three, or four values, as given below:
- If a single value is assigned, it will set the style for all 4 sides.
- If two values are assigned, the first style is set to the top and bottom sides and the second will be set to the left & right sides.
- If three values are assigned, the first style is set to the top, the second is set to the left and right, the third is set to the bottom.
- If four-style values are assigned, the styles are set to the top, right, bottom, and left, which follows the clockwise order.
The below examples illustrate the use of the border-style property.
Example 1: This example is using only one value for all borders.
Example 2: This example is using multiple values for borders.
Supported Browser: The browser supported by border-style Property are listed below:
- Chrome 1.0
- Edge 12.0
- IE 4.0
- Firefox 1.0
- Safari 1.0
- Opera 3.5
My Personal Notes arrow_drop_up
Please Login to comment...