clear 屬性設(shè)置一個元素的側(cè)面是否允許其他的浮動元素。
Object.style.clear=left|right|both|none
值 | 描述 |
---|---|
left | 在左側(cè)不允許浮動元素 |
right | 在右側(cè)不允許浮動元素 |
both | 在左右兩側(cè)均不允許浮動元素 |
none | 默認(rèn)。允許浮動元素出現(xiàn)在兩側(cè)。 |
本例不允許文本左邊的浮動元素:
<html>
<head>
<style type="text/css">
img
{
float:left;
}
</style>
<script type="text/javascript">
function clearLeft()
{
document.getElementById("p1").style.clear="left";
}
</script>
</head>
<body>
<img src="logocss.gif" width="95" height="84" />
<p id="p1">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="clearLeft()"
value="Clear left side of text" />
</body>
</html>
如對本文有疑問,請?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會為你解答??! 點擊進入論壇
Powered by 365建站網(wǎng) RSS地圖 HTML地圖
copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號