解决社群分享嵌入网页居中问题, 使iframe居中代码, 实现框架内容嵌入网页居中。
<pre class="brush:html;toolbar:false;"><!DOCTYPE html><html lang="en"> <head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>社群人脉</title>
<style type="text/css">
.box { position: absolute; }
body { background-color: rgb(86, 214, 231); }
#shequn { width: 550px; height: 605px; align-items: center; }
</style>
<script> window.onload = function () {
var oBox = document.getElementById("box"); adjustResize(); window.onresize = window.onscroll = adjustResize; function adjustResize() { var iWidth = document.documentElement.clientWidth; var iHegiht = Math.max( document.documentElement.clientHeight, document.body.clientHeight ); oBox.style.left = (iWidth - oBox.offsetWidth) / 2 + "px"; oBox.style.top = (iHegiht - oBox.offsetHeight) / 2 + "px"; } };
</script>
</head>
<body>
<div class="box" id="box">
<iframe src="http://ww.wwww2.com/app/index.php?c=entry&i=1&do=index&m=gf_qddh5" id="shequn" >
</iframe>
</div>
</body>
</html>
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。欢迎各位朋友转载,但请注明文章出处,附上文章链接。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。