首页 > 代码库 > iframe嵌套网页

iframe嵌套网页

把iframe嵌套的网页放在某一位置,只需在iframe外加个框,改变框的位置即可,如:

<!doctype html><html lang="zh"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"><title></title></head><body><div class="main">    <iframe src="http://www.bootcss.com/" onl oad="changeFrameHeight()" id="myiframe" scrolling="yes" frameborder="0"></iframe></div></body>

 

css如下:

<style type="text/css">    *{ padding: 0; margin: 0;}    body{background: green}    .main{ width: 80%; height: 500px; margin: 0 auto;}    .main iframe{ display: block; width:100%; height: 100%;}    </style>

 

效果如图:

技术分享

 

iframe嵌套网页