HTML DOM Image vspace 屬性
定義和用法
vspace 屬性設置或返回圖像的頂部和底部的空白。
space 和vspace 屬性可與align 一同使用,來設置圖像與周圍文本的距離。
語法
imageObject.vspace=pixels
瀏覽器支持
所有主要瀏覽器都支持vspace 屬性
實例
實例
下面的例子將設置圖像的hspace 和vspace 屬性:
<html>
<head>
<script>
function setSpace()
{
document.getElementById("compman").hspace="50";
document.getElementById("compman").vspace="50";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif" alt="Computerman">
<p>Some text. Some text. Some text. Some text.</p>
<input type="button" onclick="setSpace()" value="Set hspace and vspace">
</body>
</html>
<head>
<script>
function setSpace()
{
document.getElementById("compman").hspace="50";
document.getElementById("compman").vspace="50";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif" alt="Computerman">
<p>Some text. Some text. Some text. Some text.</p>
<input type="button" onclick="setSpace()" value="Set hspace and vspace">
</body>
</html>
嘗試一下»
Image對象