最近碰到需要调用别的网站的头和底部,百度看用法,试了几个都没有作用,好容易看到一个有用的,怕以后用到忘记,现在记录下来。
我找到的方法需要两个页面实现,现在以https://zhidao.baidu.com/ 右侧的我要提问和我来回答为例:
第一页的iframe代码:
<iframe src="https://zhidao.baidu.com/" width="1190" height="565" frameborder="0" scrolling="no" style="position: absolute; top: -197px; left: -903px;"></iframe>
先用单独建一页用top和left定位出我需要页面的那部分,底部和右侧用宽和高的大小来控制
第二页的iframe代码:
<div style="margin-left: 50px; margin-top: 20px;"> <iframe width="270" height="368" src="22.html" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> </div>
第二页用iframe调用刚刚已经写好的页面就实现了我想要的效果