设置文本或图像出现(浮动)在另一个元素中的什么地方。
</>code
- Object.style.cssFloat=left|right|none
值 | 描述 |
---|---|
left | 图像或文本浮动在父元素的左边。 |
right | 图像或文本浮动在父元素的右边。 |
none | 图像或文本浮动显示在它在父元素中出现的位置。 |
注释:如果在一行中对于浮动元素而言空间太少,则这个元素会跳到下一行,这个过程会持续到有足够空间的一行为止。
本例设置图像浮动于左边:
</>code
- <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>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号