HTML DOM Style borderTop property
Definition and Usage
borderTop shorthand property to set or return on three separate border properties.
With this property, you can set / return:
- border-top-width
- border-top-style
- border-top-color
grammar
Setting borderTop properties:
Object.style.borderTop="width style color"
Back borderTop properties:
Object.style.borderTop
Tip: borderTop property has no default value.
参数 | 描述 |
---|---|
width | 设置上边框的宽度。 |
style | 设置上边框的样式。 |
color | 设置上边框的颜色。 |
Browser Support
All major browsers support borderTop property.
Examples
Examples
Change the border width, style, and color:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<style type="text/css">
#ex1{
border: thin dotted #FF0000;
}
</style>
<script>
function displayResult(){
document.getElementById("ex1").style.borderTop="thick solid #0000FF";
}
</script>
</head>
<body>
<div id="ex1">这是一些文本。</div>
<br>
<button type="button" onclick="displayResult()">修改上边框</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<style type="text/css">
#ex1{
border: thin dotted #FF0000;
}
</style>
<script>
function displayResult(){
document.getElementById("ex1").style.borderTop="thick solid #0000FF";
}
</script>
</head>
<body>
<div id="ex1">这是一些文本。</div>
<br>
<button type="button" onclick="displayResult()">修改上边框</button>
</body>
</html>
try it"
Style Objects