HTML CSS examples for CSS Property:border-top-style
The border-top-style CSS property sets the style of an element's top border individually. However in many cases the shorthand CSS properties like border-style or border-top are more convenient to use and preferable.
The following table summarizes the usages context and the version history of this property.
Item | Value |
---|---|
Default value: | none |
Applies to: | All elements |
Inherited: | No |
Animatable: | No. |
The syntax of the property is as follows:
border-top-style: none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset | inherit
The example below shows the border-top-style property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS border-top-style property</title> <style type="text/css"> p {<!-- w w w. j av a2 s .c o m--> border-top-width: 3px; } p.none { border-top-style: none; } p.dotted { border-top-style: dotted; } p.dashed { border-top-style: dashed; } p.solid { border-top-style: solid; } p.double { border-top-style: double; } p.groove { border-top-style: groove; } p.ridge { border-top-style: ridge; } p.inset { border-top-style: inset; } p.outset { border-top-style: outset; } </style> </head> <body> <h1>Various border style.</h1> <p class="none">No top border.</p> <p class="dotted">A dotted top border.</p> <p class="dashed">A dashed top border.</p> <p class="solid">A solid top border.</p> <p class="double">A double top border.</p> <p class="groove">A groove top border.</p> <p class="ridge">A ridge top border.</p> <p class="inset">An inset top border.</p> <p class="outset">An outset top border.</p> </body> </html>
The following table describes the values of this property.
Value | Description |
---|---|
none | No border will be displayed. |
hidden | Same as none, except the case where table cells have collapsed borders and the two cells share a border. The hidden value ensures that no border is drawn, since hidden take precedence over all other border styles. |
dotted | Displays the border as a series of dots. |
dashed | Displays the border as a series of short line segments i.e. dashes. |
solid | Displays the border as a single solid line. |
double | Displays the border as a two parallel solid lines with some space between them. The sum of the two lines and the space between them equals the value of border-width. |
groove | Displays the border as it were carved into the canvas. It gives the impression of 3D that is typically achieved by creating a shadow from two colors that are slightly lighter and darker than the border-color. |
ridge | Displays the border that has the opposite effect of groove: It also gives the impression of 3D, the border looks as though it were coming out of the canvas. |
inset | Displays the border that makes the element's box look as though it were embedded in the canvas. It gives the impression of 3D that is typically achieved by creating a shadow from two colors that are slightly lighter and darker than the border-color. |
outset | Displays the border that has the opposite effect of inset: It also gives the impression of 3D, the border makes the box look as though it were coming out of the canvas. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element border-top-style property. |