<!DOCTYPE html>
<html>
<head>
<title>helloKitty</title>
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="../lib/jquery.mobile-1.1.0.css" />
<script type="text/javascript" src="../lib/jquery-1.7.1.js"></script>
<script type="text/javascript" src="../lib/jquery.mobile-1.1.0.js"></script>
<style type="text/css">
div .test {
position: absolute;
top: 50%;
left: 50%;
margin: -5.8em 0 0 -4.4em;
width: 11.6em;
height: 8.8em;
}
</style>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>header</h1>
</div>
<div data-role="content">
<div class='test'>
<img src="view.png" />
</div>
<div data-role="footer" data-position = "fixed" >
<h1>footer</h1>
</div>
</div>
</div>
</body>
</html>
这个应该可以让这个11.6em*8.8em的view.png居中,不知道orientationchange事件发生的时候,会怎么样。改天解决。
来源:https://www.cnblogs.com/happyPawpaw/archive/2012/08/02/2620009.html