问题
I developp with phonegap and I have got a problem with the style.
I just want to place a footer at the bottom.
Here is my index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<script type="text/javascript" src="cordova-2.6.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<body id="page">
<div id="bottom">
<p>Bonjour</p>
</div>
</body>
</html>
This is my css
#bottom {
position:fixed;
width: 100%;
bottom: 0px;
background-color: #f00;
}
body {
min-height: 533px;
height : 100%;
padding: 0;
margin: 0;
}
And I've got this
Result on the phone
How can I solve this, or anyone meet the same problem?
Thanks !
回答1:
Check the styles, make sure there aren't any other styles that are being automatically added. The one thing to check in particular is the style for the <p> Try setting the margin and padding both to 0.
回答2:
First thing, is that to position fixed does not work on IE.
To fix this, I add to include jquery on my project and change the position to absolute
#bottom {
position:absolute;
width: 100%;
bottom: 0px;
background-color: #f00;
margin: 0px;
padding: 0px;
left: 0px;
}
and my index.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.css">
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.js"></script>
<script type="text/javascript" src="cordova-2.6.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<div id="bottom">
<p>Bonjour</p>
</div>
</body>
</html>
And now it's working
来源:https://stackoverflow.com/questions/16355253/phonegap-windows-phone-gap-space-bottom