首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

iframe高阔自适应

2012-09-13 
iframe高宽自适应html xmlnshttp://www.w3.org/1999/xhtmlheadmeta http-equivContent-Type co

iframe高宽自适应

<html xmlns="http://www.w3.org/1999/xhtml">  
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>iframe</title> 
<style> 
    html,body,.i_a{height:100%} 
    body{margin:0} 
    .i_a{width:100%;border:none} 
</style> 
</head> 
 
<body> 
<p>我是首页顶部</p>
    <iframe src="http://www.iwaimai.net" class="i_a"></iframe> 
<p>我是底部</p>
</body> 
</html> 
这个再测下看,会有滚动条的。  纯css是无法实现iframe高度自适应的。 2 楼 liuxiang822 2012-01-11   你上下都加了P标签 ,想要高度自适应很简单。给P标签高度加上百分比,然后加上iframe高度百分比等于body的高度百分比就行!

热点排行