Properti HTML DOM Style borderTop
Definisi dan Penggunaan
borderTop properti singkat untuk mengatur atau kembali pada tiga sifat perbatasan terpisah.
Dengan properti ini, Anda dapat mengatur / pulang:
- border-top-width
- border-top-style
- border-top-warna
tatabahasa
Pengaturan properti borderTop:
Object.style.borderTop="width style color"
Sifat Kembali borderTop:
Object.style.borderTop
Tip: properti borderToptidak memiliki nilai default.
参数 | 描述 |
---|---|
width | 设置上边框的宽度。 |
style | 设置上边框的样式。 |
color | 设置上边框的颜色。 |
Dukungan Browser
Semua browser utama mendukung properti borderTop.
contoh
contoh
Mengubah lebar perbatasan, gaya, dan warna:
<!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>
Coba »
gaya Objects