body 的宽度 100% ≠ 100% (仅 IE6)通常表现为 iframe 出现纵向滚动条时同时出现横向滚动条,

简单粗暴的使用body{overflow-x:hidden;}是不负责任的,有时会截断要显示的内容第一个页面(父页面)

<iframe frameborder="0" height="300" scrolling="auto" src="iframe.html" width="500">

 

第二个页面(iframe)

HTML

<div></div>

CSS

body, div{margin:0;padding:0;}div{background-color:yellow;height:500px;}

正常效果

 

body 的宽度 100% ≠ 100% (仅 IE6)(转)

IE6

body 的宽度 100% ≠ 100% (仅 IE6)(转)

解决方法

在iframe中html页面上设置body的style

body{_width:expression(this.parentNode.offsetHeight > this.parentNode.scrollHeight ? '100%' : parseInt(this.parentNode.clientWidth) + 'px');}
 

相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
  • 2022-01-29
  • 2021-04-07
猜你喜欢
  • 2022-12-23
  • 2021-05-26
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2021-12-14
  • 2021-10-05
相关资源
相似解决方案