AppMobi背景问题
基本上我想设置背景颜色(或图像)。我正在使用 HTML CSS 和 JQuery Mobile 编写。
我正在尝试创建一个基本的 AppMobi 应用程序,但在以下示例中我似乎无法更改我的背景:
<div data-role="page" id="page">
<div data-role="header" data-theme="c">
<h1>Page One</h1>
</div>
<div data-role="content" data-theme="c">
<ul data-role="listview" data-theme="b">
<li><a href="#page2">Page Two</a></li>
<li><a href="#page3">Page Three</a></li>
<li><a href="#page4">Page Four</a></li>
<li><a href="#page3" data-role="button" data-icon="delete">Delete</a></li>
</ul>
</div>
<div data-role="footer" style="position:fixed; bottom:0;" data-theme="c">
<h4>Page Footer</h4>
</div>
</div>
我尝试同时更改 HTML 和 CSS 中的背景,但我似乎无法更改第 1 页的背景颜色(示例)。第 1 页包括 4 个按钮和一个“粘性页脚”。按钮显示在屏幕顶部,但按钮之间或列表和页脚之间的内容不会改变颜色。我尝试在标头和内联中编写 HTML 或 CSS。
我怎样才能改变这个“div”块的背景颜色?
提前感谢
basically I am trying to set a background color (or image). I am writing in HTML CSS and JQuery Mobile.
I'm trying to create a basic AppMobi app but I don't seem to be able to change my background in the following example:
<div data-role="page" id="page">
<div data-role="header" data-theme="c">
<h1>Page One</h1>
</div>
<div data-role="content" data-theme="c">
<ul data-role="listview" data-theme="b">
<li><a href="#page2">Page Two</a></li>
<li><a href="#page3">Page Three</a></li>
<li><a href="#page4">Page Four</a></li>
<li><a href="#page3" data-role="button" data-icon="delete">Delete</a></li>
</ul>
</div>
<div data-role="footer" style="position:fixed; bottom:0;" data-theme="c">
<h4>Page Footer</h4>
</div>
</div>
I have tried to both change the background in HTML and CSS, but I don't seem to be able to change the background color page 1 (example). Page 1 includes 4 buttons, and a "sticky footer". The buttons shown on top of screen, but the content between buttons or lists and footer will not change color. I tried writing HTML or CSS in Header and also inline.
How would I be able to change the background color of this 'div' chunk?
Thanx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的问题与 AppMobi 无关,而是与 JQuery Mobile 相关。
JQuery Mobile 的工作方式是加载内容,然后“处理”它并应用样式。发生的情况是 JQuery Mobile 正在覆盖您的默认 CSS 样式。打开 JQuery Mobile CSS 文件并在其中进行更改。
Your issue isn't related to AppMobi, but JQuery Mobile in general.
The way JQuery Mobile works is it loads the content, then "processes" it and applies styles. What's happening is that JQuery Mobile is overriding your default CSS styles. Open up the JQuery Mobile CSS file and change it there.
在标准示例应用程序中,以下是 index.html 中用于设置背景的代码块。
您可以看到它只是设置了名为background.jpg 的图像,位于images 目录中。您可以编辑该背景图像,获取一个新的并指向该背景图像,或者放入一些漂亮的 webkit 代码或其他内容:(index.html 的 head 标签)
因此您应该能够为您的 Page 1 div 提供一个 id,并且只需将图像或任何其他您想要的内容应用到该 div id 即可。
In standard sample apps, here is the block of code in index.html that sets your background.
Which you can see just sets the image titled background.jpg, located in the images directory. You can either edit that background image, get a new one and point to that, or put in some nifty webkit code or something: (head tag of index.html)
So you should be able to give your Page 1 div an id, and just apply either the image or whatever else you want to that div id.