border-top
Description
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. |
Syntax and Property Values
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 |
Example
<!DOCTYPE HTML>
<html>
<head>
<style>
div {<!--from ww w . j a v a2s.c o m-->
border-top: 3px dashed darkkhaki;
background: lightyellow;
}
</style>
</head>
<body>
<div>java2s.com</div>
</body>
</html>
The code above generates the following result.