by kevin
  
    28.   
      十二月 2018 16:01
  >
  
  
  
很多时候,我们不希望富文本编辑的结果,被页面的样式影响,下面这个方案还不错。
          <div class="artical_body">
                    <iframe id="contentFrame" class="contentFrame" style="overflow: hidden; bo:0; width: 100%; height: 100%;" src="javascript:void(function(){document.open();document.write('htmlencode(这里是你的html,请先进行htmlencode)');document.close();}())"></iframe>
                    <script>   1: $(".artical_body").css("height",$("#contentFrame").contents().find("body").height()+"px");</script>
                </div>
 
 
设置iframe的src为一段输出html的js。
然后需要在页面中使用js动态调整iframe容器的高度。