我有一个非常烦人的问题,即持久的 jQuery 导航栏出现在内容宽度之外,比页面上的其他内容宽得多,这是我在预览 HTML 时看到的:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
在它中使用<head>
它应该将内容宽度设置为设备宽度,它具有标题和文本元素,但不适用于导航栏。
这是我上面的完整 HTML 文件:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/SmartConf.css" />
<link rel="stylesheet" href="css/jquery.mobile-1.1.1.min.css" />
</head>
<body onload="WL.Client.init({})" id="content">
<div data-role="page">
<div data-role="header">
<h1>Home</h1>
</div><!-- /header -->
<div data-role="content">
<p>Home</p>
</div><!-- /content -->
<div data-role="footer" data-id="foo1" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="tweets.html">Tweets</a></li>
</ul>
</div><!-- /navbar -->
</div><!-- /footer -->
</div><!-- /page -->
<script src="js/SmartConf.js"></script>
<script src="js/messages.js"></script>
<script src="js/auth.js"></script>
<script src="js/jquery/jquery.mobile-1.1.1.js"></script>
</body>
</html>
有没有办法将导航栏挤到主内容窗口中?
谢谢
编辑:
如果我id="content"
从body
标签中删除,那么宽度会正确调整,但是这样做我会在 Worklight 启动中遇到各种失败,因为它引用了“内容”ID 标签,因此我认为 body 和 div 都存在冲突正在争夺content
...的ID