使用jQuery Mobile更改背景颜色

时间:2022-11-21 16:23:31

I want to change the global background-color for my app, but things don't work.

我想更改我的应用程序的全局背景颜色,但事情不起作用。

Adding CSS to the body doesn't work (neither does adding CSS to html element)

将CSS添加到正文不起作用(也没有将CSS添加到html元素)

body {
    background-color:#2b2e31;
}

Adding id's to my div-elements works sometimes, but I'm not gonna add an Id to all my elements.

将id添加到我的div元素有时会起作用,但我不会在我的所有元素中添加Id。

Does anybody know how to solve this?

有谁知道如何解决这个问题?

3 个解决方案

#1


12  

This solved it

这解决了它

.ui-page { 
    background:#2b2e31;
}

#2


1  

Or maybe this might work. Just download the 'Without-A-Theme' jQuery mobile CSS version. Here is the link: http://code.jquery.com/mobile/1.3.2/jquery.mobile.structure-1.3.2.min.css 使用jQuery Mobile更改背景颜色

或许这可能会奏效。只需下载'无主题'jQuery移动CSS版本。这是链接:http://code.jquery.com/mobile/1.3.2/jquery.mobile.structure-1.3.2.min.css

#3


0  

You need to modify the ui-page class. It may also be helpful to use !important so the rule will always be applied no matter where it appears in the CSS.

您需要修改ui-page类。使用!important也可能会有所帮助,因此无论CSS出现在何处,都将始终应用规则。

.ui-page {
  background-color: #2b2e31 !important;
}

#1


12  

This solved it

这解决了它

.ui-page { 
    background:#2b2e31;
}

#2


1  

Or maybe this might work. Just download the 'Without-A-Theme' jQuery mobile CSS version. Here is the link: http://code.jquery.com/mobile/1.3.2/jquery.mobile.structure-1.3.2.min.css 使用jQuery Mobile更改背景颜色

或许这可能会奏效。只需下载'无主题'jQuery移动CSS版本。这是链接:http://code.jquery.com/mobile/1.3.2/jquery.mobile.structure-1.3.2.min.css

#3


0  

You need to modify the ui-page class. It may also be helpful to use !important so the rule will always be applied no matter where it appears in the CSS.

您需要修改ui-page类。使用!important也可能会有所帮助,因此无论CSS出现在何处,都将始终应用规则。

.ui-page {
  background-color: #2b2e31 !important;
}