IFrame align 属性
定义和用法
align 属性可设置或者返回 iframe 元素 align 属性的值。
align 属性指定如何根据周围的文本来排列 iframe。
提示:iframe元素是一个内嵌元素(它不是在页面上插入一个新的线),这意味着文本和其他元素可以围绕着它。
因此,它可以根据周围的文本来排列 iframe。
语法
align 属性可以是以下值:
值
|
描述
|
left
|
iframe 左对齐
|
right
|
iframe 右对齐
|
middle
|
iframe 居中对齐
|
top
|
iframe 顶部对齐
|
bottom
|
iframe 底部对齐
|
浏览器支持
![Internet Explorer Internet Explorer](/jiaocheng/img/bubuko-jiaocheng-f3a6d480-8791-4778-91a5-df56b541a5cc.gif)
![Firefox Firefox](/jiaocheng/img/bubuko-jiaocheng-d8de354b-8846-4d50-b1c8-96cb95308787.gif)
![Opera Opera](/jiaocheng/img/bubuko-jiaocheng-d5769a74-c880-464f-9ff2-110d1ec61e01.gif)
![Google Chrome Google Chrome](/jiaocheng/img/bubuko-jiaocheng-ef734143-ba33-4c12-9427-a6d88b5a244a.gif)
所有主要浏览器都支持 align 属性
实例
iframe 右对齐:
<html>
<body>
<p>This is some text. This is some text. This is some text.
<iframe id="myframe" src="http://bubuko.com">
<p>Your browser does not support iframes.</p>
</iframe>
This is some text. This is some text. This is some text.</p>
<script>
document.getElementById("myframe").align="right";
</script>
</body>
</html>