如下图中的场景,页面分为头和内容两个大块,head高度是50PX,1PX的border,中间的内容是iframe,高度需要每次进行计算,如下

<script>
$(function(){ setIframeHeight(); }) function setIframeHeight(){ $("#mainFrame").height(document.body.clientHeight-52); } $(window).resize(function() { setIframeHeight(); });
</script>

IE、Firefox测试下来都OK,结果在测试chrome的时候,发现上下有晃动,之后各种找问题,发现多了5PX。

最终发现是因为div元素的font-size引起的,最后设置font-size:0; 纠结3小时的问题终于解决了。。。

<div class="row">
  <div  class="col-md-12" style="font-size: 0;">
	<iframe  > </iframe>
  </div>
</div>    

  

 

font-size引起的页面晃动

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
  • 2021-08-25
  • 2022-12-23
  • 2021-05-22
  • 2022-12-23
猜你喜欢
  • 2021-12-11
  • 2022-01-08
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
相关资源
相似解决方案