border-top
shorthand property defines the width, color, and style of the top border.
Item | Value |
---|---|
Inherited | No. |
Version | CSS1 |
JavaScript syntax | object.style.borderTop="5px solid red" |
Applies to | All elements. |
border-top: border-width border-style border-color;
The property values are listed in the following table.
Value | Description |
---|---|
border-top-width | Set the width of the top border |
border-top-style | Set the style of the top border |
border-top-color | Set the color of the top border |
inherit | Inherit the border-top property from the parent element |
border-top |
Yes | Yes | Yes | Yes | Yes |
An example showing how to use border-top CSS property.
<!DOCTYPE HTML>
<html>
<head>
<style>
div {<!-- w w w . ja v a 2 s . c o m-->
border-top: 3px dashed darkkhaki;
background: lightyellow;
}
</style>
</head>
<body>
<div>java2s.com</div>
</body>
</html>