I have a simple strange question about iframe, but I'll be happy if I can find a solution from you :)
I have an iframe which view some content like picture 1
What I want is to see iframe like (picture 2) when I open containing webpage, I want to view the content from the center of horizontal.
Thank you
My source code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div style="width: 1680px; background: #ccc;">
<div style="float: left; width: 740px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;">
<span>A1</span>
</div>
<div style="float: left; width: 740px; height: 60px;"></div>
<br clear="All" />
<div style="float: left; width: 320px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;">
<span>A2</span>
</div>
<div style="float: left; width: 640px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;">
<span>A3</span>
</div>
<div style="float: left; width: 320px; height: 60px;"></div>
<br clear="All" />
<div style="float: left; width: 110px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;">
<span>A4</span>
</div>
<div style="float: left; width: 220px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 220px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;">
<span>A5</span>
</div>
<div style="float: left; width: 220px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 110px; height: 60px;"></div>
<br clear="All" />
<div style="float: left; width: 5px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 10px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 10px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 10px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 10px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 10px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 10px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 10px; height: 60px;"></div>
<div style="float: left; font-size: 12px; width: 200px; height: 50px; text-align: right; background: #fff;"></div>
<div style="float: left; width: 5px; height: 60px;"></div>
<br clear="All" />
</div>
</body>
</html>
This the code of the mother of iframe
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
<link href="//melchoyce.github.io/dashicons/css/dashicons.css" rel="stylesheet">
</head>
<body>
<div>
<div style="float: right; width: 180px; background: #E5E5E5;">
<ul id="side-menu">
<li><a href="index.php?mode=index"><div class="dashicons dashicons-admin-home"></div> home</a></li>
<li><a href="index.php?mode=personal_info"><div class="dashicons dashicons-id-alt"></div> info</a></li>
<li><a href="index.php?mode=view_network"><div class="dashicons dashicons-networking"></div>newtork</a></li>
<li><a href="logout.php"><div class="dashicons dashicons-migrate"></div> logout </a></li>
</ul>
</div>
<div style="float: right; margin: 8px;">
<script type="text/javascript">
$(window).load(function () {
var ifr = $("#ifr"),
ifr_doc = ifr.contents(),
ifr_doc_w, ifr_w;
ifr_w = ifr.width();
ifr_doc_w = ifr_doc.width();
ifr_doc.scrollLeft(
(ifr_doc_w - ifr_w) / 2
);
});
</script>
<iframe id="ifr" src="network.php" style="width: 1000px; height: 600px; border: 1px solid #e5e5e5;"></iframe>
</div>
<br clear="all" />
</div>
</body>
</html>
<script src="https://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>