/

HTML / CSS / JavaScript Tutorial

CSS Property: border-top-style

[this page | pdf | back links]

The CSS (CSS1) border-top-style property sets the border style of the top border of an element.

 

Valid property values (other than inherit and initial) are shown here.

 

Default Value:

none

JavaScript syntax:

e.g. object.style.borderTopStyle="groove"

Inherited:

No

Animatable:

No

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
p {border: thin solid black; width: 200px}
p.x1 {border-top-style: dashed;}
</style>
</head>
<body>
<p>1. Element with default property</p>
<p class="x1">2. Element set using in-file HTML style</p>
<p id="x2">3. Element set using JavaScript</p>

<script>
document.getElementById("x2").style.borderTopStyle = "dashed";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyBorderTopStyle() {
  var x = document.createElement("DIV"); x.style.borderTopStyle = "dashed"; return (window.getComputedStyle(x, null).borderTopStyle == "dashed");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile