Reputation: 237
I`m using jQuery mobile and I want to split the page into four parts(Fiddle) with header and footer enabled. But somehow it is not working here.. My Fiddle
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.2/jquery.mobile-1.1.2.min.css" />
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.2/jquery.mobile-1.1.2.min.js"></script>
<link rel="stylesheet" href="app.css"/>
</head>
<body>
<div data-role="page">
<div data-role="header" data-rel="back">
</div>
<div id="div1" class="a"></div>
<div id="div2" class="a"></div>
<div id="div3" class="a"></div>
<div id="div4" class="a"></div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
</body>
CSS
html, body { height: 100%; padding: 0; margin: 0; }
div.a { width: 50%; height: 50%; float: left; }
#div1 { background: #DDD; }
#div2 { background: #AAA; }
#div3 { background: #777; }
#div4 { background: #444; }
I can see only footer, but that too at the top. What am I doing wrong here?
Upvotes: 0
Views: 1783
Reputation: 31732
Use jQM grids layout.
<div class="ui-grid-a">
<div id="div1" class="ui-block-a">A1</div>
<div id="div2" class="ui-block-b">B1</div>
<div id="div3" class="ui-block-a">A2</div>
<div id="div4" class="ui-block-b">B2</div>
</div>
Resource: Grids
Upvotes: 2
Reputation: 85613
You also need to set height: 100%;
to your main parent div
In the demo if you remove height: 100%; from main div then it won't work.
Upvotes: 0