首先,这不能用 jQuery Mobile 网格来完成。该网格是为了响应和拉伸而设计的。创建我们自己的包含所需图像的网格是更好的解决方案。
我只是不明白你打算使用:
<div class="ui-bar">
还是包含它是一个错误。我在没有它的情况下完成了这个例子。如果您希望网格完全包裹图像,则无需。
这是一个工作示例:http: //jsfiddle.net/Gajotres/VUWAA/
HTML:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-theme="b" data-role="header">
<h1>Index page</h1>
</div>
<div data-role="content">
<div class="grid-container">
<div class="grid-row">
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
</div>
<div class="grid-row">
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
</div>
<div class="grid-row">
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
<a href="index.htm">
<img alt="alt..." src="http://th01.deviantart.net/fs12/150/i/2006/287/3/4/puppy_pug_3_by_WeiTat.jpg" />
</a>
</div>
</div>
</div>
</div>
</body>
</html>
CSS:
.grid-container {
margin-left: auto;
margin-right: auto;
width: 302px;
height: 452px;
}
.grid-row {
width: 302px;
height: 150px;
margin-bottom: 1px;
}
.grid-row_last-child {
margin-bottom: 0px;
}
.grid-row a {
position:relative;
float: left;
display: block;
width: 100px;
height: 150px;
margin-right: 1px;
}
.grid-row a:last-child {
margin-right: 0px;
}