jquery mobile:设置桌面浏览器的宽度和高度
我正在使用 jquery mobile 来模拟 iphone 应用程序,但桌面浏览器上的内容宽度和高度有问题。 宽度问题可以这样解决(宽度 = 320px 且内容居中对齐):
html { background-color: #333; } @media only screen and (min-width: 321px){ .ui-page { width: 320px !important; margin: 0 auto !important; position: relative !important; } }But this causes useless background under footer. I guess that background for ui-page can be replaced and one can add extra div with background for content (between header and footer), but there should be better way.
那么问题是,当在桌面浏览器中打开内容时,如何设置内容的宽度和高度?
更新: 这是示例。
I'm using jquery mobile for emulating iphone application and i have a problem with content width and height at desktop browser.
Problem with width can be solved that way (width = 320px and content align center):
html { background-color: #333; } @media only screen and (min-width: 321px){ .ui-page { width: 320px !important; margin: 0 auto !important; position: relative !important; } }
But this causes useless background under footer.
I guess that background for ui-page can be replaced and one can add extra div with background for content (between header and footer), but there should be better way.
So the question is how to set width and height for content, when it is opened in desktop browser?
Update:
Here is example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 javascript 在页面加载时调整 .ui 页面的高度 - 这是一个 jQuery 示例:
You could use javascript to resize the .ui-page's height on page load - here's a jQuery example:
您可以尝试删除页面元素的背景并将其设置在内容上。这是示例代码:
CSS
you can try to remove the background of the page element and set it at the content. here is an example code:
CSS