To place the iframe-nested web page in a certain position, just add a box outside the iframe and change the position of the box, such as:
<!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> <p class="main"> <iframe src="http://www.bootcss.com/" onload="changeFrameHeight()" id="myiframe" scrolling="yes" frameborder="0"> </iframe> </p> </body>
css is as follows:
<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>
The effect is as shown:
# #
The above is the detailed content of Example analysis of how iframe nests web pages in html. For more information, please follow other related articles on the PHP Chinese website!