JQuery Mobile - 覆盖整个字体系列主题

发布于 2025-01-08 08:45:24 字数 355 浏览 5 评论 0原文

我最近将 jQuery mobile 添加到我的网站。

然而jQuery主题打破了我以前的字体。虽然我的大部分页面都运行良好,尤其是漂亮的 jQuery Mobile 滑块,但我在字体方面遇到了真正的问题。

我设置了自定义字体,并且无需 jquery mobile css 即可正常工作。但是,一旦我包含 jquery mobile css,它就会覆盖我的字体。

我尝试将 data-role=“none” 添加到正文和 div,但这没有帮助。

我也尝试添加 data-theme = "none" 但这也没有帮助。

有没有办法在我的页面主体上禁用 jQuery 自定义字体系列主题?

感谢您的帮助。

I recently added jQuery mobile to my website.

However, the jQuery theme broke my previous fonts. While most of my page works great, especially the nice jQuery Mobile sliders, I am having a real problem with the fonts.

I have custom fonts set and they work correctly without the jquery mobile css. However, once I include the jquery mobile css it overrides my fonts.

I have tried adding data-role= "none" to the body and the divs but that did not help.

I have also tried adding data-theme = "none" but that also does not help.

Is there a way to disable jQuery custom font-family theming on the body of my page?

Thanks for the help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

青巷忧颜 2025-01-15 08:45:24

这是我的 CSS,用于将整个应用程序字体替换为 Roboto(Android 4.0 ICS 字体)。

  @font-face {
    font-family: 'RobotoRegular';
    src: url('../font/roboto/RobotoRegular.eot');
    src: url('../font/roboto/RobotoRegular.eot?#iefix') format('embedded-opentype'),
         url('../font/roboto/RobotoRegular.woff') format('woff'),
         url('../font/roboto/RobotoRegular.ttf') format('truetype'),
         url('../font/roboto/RobotoRegular.svg#RobotoRegular') format('svg');
    font-weight: normal;
    font-style: normal;
  }

  /* Android jQM Font Style Overrides */
  body  * {
    font-family: "RobotoRegular" !important;
    font-weight: normal !important;
  }

如果上述还不够,您可能还必须针对特定元素。我还必须包括以下内容:

  .ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-bar-a,.ui-body-a,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-a input,.ui-body-a select,.ui-body-a textarea,.ui-body-a$
    font-family: "RobotoRegular";
  }

我希望你来对了。祝你好运。

Here is my CSS for replacing the entire applications font with Roboto, the Android 4.0 ICS font.

  @font-face {
    font-family: 'RobotoRegular';
    src: url('../font/roboto/RobotoRegular.eot');
    src: url('../font/roboto/RobotoRegular.eot?#iefix') format('embedded-opentype'),
         url('../font/roboto/RobotoRegular.woff') format('woff'),
         url('../font/roboto/RobotoRegular.ttf') format('truetype'),
         url('../font/roboto/RobotoRegular.svg#RobotoRegular') format('svg');
    font-weight: normal;
    font-style: normal;
  }

  /* Android jQM Font Style Overrides */
  body  * {
    font-family: "RobotoRegular" !important;
    font-weight: normal !important;
  }

You may have to target specific elements too if the above is not enough. I had to also include the following:

  .ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-bar-a,.ui-body-a,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-a input,.ui-body-a select,.ui-body-a textarea,.ui-body-a$
    font-family: "RobotoRegular";
  }

I hope you come right. Good luck.

新雨望断虹 2025-01-15 08:45:24

我会检查该元素并准确找出指定字体的位置,例如我刚刚发现此处指定了字体:

.ui-body-c, .ui-body-c input, .ui-body-c select, .ui-body-c textarea, .ui-body-c button

因此您可以通过指定相同的选择器并呈现您自己的字体来覆盖您自己的样式表中的字体:)

I would inspect the element and find out exactly where the fonts are being specified for example I just found that font's are specified here:

.ui-body-c, .ui-body-c input, .ui-body-c select, .ui-body-c textarea, .ui-body-c button

So you can override that in your own stylesheet by specifying the same selector and presenting your own fonts :)

一个人的旅程 2025-01-15 08:45:24

据我了解... jQuery mobile 可能只是将他自己的 css 字体发送到您的组合中。如果您有一个带有字体集的 css 文件:

尝试通过为您的字体样式添加 !important 进行一些测试。

希望这能帮助您找到解决方案:)

From what I understand... jQuery mobile might just send his own css fonts into your mix. If you have a css file with the font set :

Try some testing by adding !important for your font styles.

Hope this will help you figure out a solution :)

你在我安 2025-01-15 08:45:24

感谢 agrublev 和 darryn.ten 的帮助,以下内容对我有用:

以下是更改正文和字体阴影的示例:

.ui-body-c,.ui-dialog.ui-overlay-c{
    text-shadow: 0pt 0px 0pt rgb(0, 0, 0); 
}
.ui-body-c, .ui-body-c input, .ui-body-c select, .ui-body-c textarea, .ui-body-c button{
        font-family: Helvetica, Arial, sans-serif, Verdana;
        font-size: 12px;
        text-shadow: none;
        color:black;
}

Thanks to the help by agrublev and darryn.ten the following worked for me:

Here are examples to change the shadow of the body and fonts:

.ui-body-c,.ui-dialog.ui-overlay-c{
    text-shadow: 0pt 0px 0pt rgb(0, 0, 0); 
}
.ui-body-c, .ui-body-c input, .ui-body-c select, .ui-body-c textarea, .ui-body-c button{
        font-family: Helvetica, Arial, sans-serif, Verdana;
        font-size: 12px;
        text-shadow: none;
        color:black;
}
星星的轨迹 2025-01-15 08:45:24

为 jquery mobile 创建您自己的 css 并覆盖字体系列 给您自己的字体系列

creat your own css for jquery mobile and override font family give your own font family

茶花眉 2025-01-15 08:45:24

jquery mobile 使用主题。点击 http://themeroller.jquerymobile.com/

在“全局”选项卡中设置字体(对我来说: Raleway、Verdana 等),下载并安装主题即可。
对于 jqmobile,您需要使用主题 css、jqm 图标和 jqm 结构,而不是通常的单个 jqm css。

覆盖 css 中的内容可能会让您在不同的浏览器中遇到不同的麻烦...而这不是 jquerymobile 的重点。

jquery mobile uses themes. Hit http://themeroller.jquerymobile.com/

set the font in the "global" tab (for me: Raleway, Verdana, etc), download and install the theme and you're set.
For jqmobile, you need to use your theme css, jqm icons, and jqm structure INSTEAD of the usual single jqm css.

overriding stuff in css may get you in different trouble with different browsers... And that's NOT the point with jquerymobile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文