Html5 - Css样式被jquery移动样式覆盖 [英] Html5 - Css styles are overriden by jquery mobile style

查看:115
本文介绍了Html5 - Css样式被jquery移动样式覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用html5,css,jquery mobile来开发一些应用程序。但是html元素和css被jquery-mobile默认样式表(jquery.mobile-1.0.css)覆盖。

I am using html5, css, jquery mobile to develop some application. But the html elements and css are overridden by jquery-mobile default style sheet (jquery.mobile-1.0.css).

我如何克服这个问题?我只是想把我的风格用在我的页面上。例如,如果我在body标签中给出bgcolor =red,它将无法工作..

How can i overcome this problem? I just want to use my style to my page. For example If I give bgcolor="red" in body tag, it will not work..

请给我一些建议......

Please give me some suggestions....

感谢你....

推荐答案

使用CSS并在必要时将属性标记为!important

Use CSS and if necessary mark attributes as !important.

body { background-color: #f00; }

如果这不起作用,例如因为jQuery Mobile CSS中的另一个选择器会覆盖它,使用!important

If that doesn't work, e.g. because another selector from the jQuery Mobile CSS overrides it, use !important:

body { background-color: #f00 !important; }

这里解释了优先规则: http://www.w3.org/TR/CSS21/cascade.html#specificity - 但是,通常只是测试您的规则是否已经有效或是否有效需要!important 就足够了。

The precedence rules are explained here: http://www.w3.org/TR/CSS21/cascade.html#specificity - however, usually simply testing if your rule already works or if it needs !important is sufficient.

你当然应该做的是在 > jQuery移动CSS。即使没有!important ,这也会在样式表中为同等加权的规则提供更高的优先级。

What you certainly should do is including your stylesheet after the jQuery mobile CSS. This gives equally-weighted rules in your stylesheet a higher priority even without !important.

这篇关于Html5 - Css样式被jquery移动样式覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆