Properti HTML DOM Style outlineWidth
Definisi dan Penggunaan
set properti outlineWidth atau mengembalikan lebar elemen sekitar profil.
tatabahasa
Pengaturan properti outlineWidth:
Object.style.outlineWidth="thin|medium|thick|length|inherit"
Sifat Kembali outlineWidth:
Object.style.outlineWidth
值 | 描述 |
---|---|
thin | 定义细的轮廓。 |
medium | 默认。定义中等的轮廓。 |
thick | 定义粗的轮廓。 |
length | 使用 px、cm 等单位定义轮廓的宽度。 |
inherit | 轮廓的宽度从父元素继承。 |
Dukungan Browser
Semua browser utama mendukung properti outlineWidth.
Catatan: IE7 dan versi sebelumnya tidak mendukung properti outlineWidth.IE8 hanya menyediakan! DOCTYPE didukung properti outlineWidth. IE9 mendukung properti outlineWidth.
Tips dan Catatan
garis kontur di sekitar elemen sekitarnya. Hal ini ditampilkan dalam margin elemen sekitarnya. Namun, berbeda dengan properti perbatasan.
Bagian dari profil bukanlah ukuran elemen, dan karena itu lebar dan tinggi atribut dari elemen tidak termasuk lebar profil.
contoh
contoh
Mengubah lebar garis besar:
<html>
<head>
<style type="text/css">
#ex1
{
border:1px solid red;
outline:green dotted thick;
}
</style>
<script>
function displayResult()
{
document.getElementById("ex1").style.outlineWidth="10px";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change outline width</button>
</body>
</html>
<head>
<style type="text/css">
#ex1
{
border:1px solid red;
outline:green dotted thick;
}
</style>
<script>
function displayResult()
{
document.getElementById("ex1").style.outlineWidth="10px";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change outline width</button>
</body>
</html>
Coba »
gaya Objects