設(shè)置文本或圖像出現(xiàn)(浮動)在另一個元素中的什么地方。
Object.style.cssFloat=left|right|none
值 | 描述 |
---|---|
left | 圖像或文本浮動在父元素的左邊。 |
right | 圖像或文本浮動在父元素的右邊。 |
none | 圖像或文本浮動顯示在它在父元素中出現(xiàn)的位置。 |
注釋:如果在一行中對于浮動元素而言空間太少,則這個元素會跳到下一行,這個過程會持續(xù)到有足夠空間的一行為止。
本例設(shè)置圖像浮動于左邊:
<html>
<head>
<script type="text/javascript">
function setFloat()
{
document.getElementById("img1").style.cssFloat="left";
}
</script>
</head>
<body>
<img id="img1" src="logocss.gif" />
<p>This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>
<input type="button" onclick="setFloat()"
value="Set image to float to the left" />
</body>
</html>
如對本文有疑問,請?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會為你解答!! 點擊進入論壇
Powered by 365建站網(wǎng) RSS地圖 HTML地圖
copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號