Styling Borders with CSS Border-Style Property
To go beyond the simple, default web pages, we need to learn how to add style to our content. To do that, we need to create a Cascading Style Sheet and add some properties to our content. One common property is the Border-Style. The Border-Style property consists of nine border styles that allow us to change the visual style of any box. This property is simple to use. Getting to know it will help you to create more designed web pages. Let’s take a look at all the different ways we can style our boxes’ borders:
Is the default property. No border is displayed.
A sequence of dots is displayed:
A sequence of short lines form the border:
A single line segment round the border. The “original” border:
Two solid line segments form the border:
Looks like an indentation:
A raised border effect:
An insertion drops into the box:
An inception of the border rises from the box:
- To specify the visual style of a border use the border-style property.
- The default style is: None. To display a border the property needs to be set.
- Borders are added on top of the box’s background; so, make sure to add padding.
- The following styles require a border-color property: Groove, Ridge, Inset, and Outset.
- The border-style property can be set to style the entire border, or just the top, right, bottom or left side of the box. Consequently, it can have from one to four values.
- This property is NOT inherited.
- This property is supported in the majority of browsers. Firefox (1), Internet Explorer (4, 5, and 6) – earlier versions require inline elements to be absolute positioned, Mozilla (1), Netscape (6 and 7), and Opera (3, 4, 5, 6, 7, and 8).
- Shorthand version of the “border-style” property is “border”.
Now you can go beyond the simple, default Web pages. Add a special touch to your design using the border-style property.