php CSS无法加载到移动的设备上,但在桌面上运行良好

inkz8wg9  于 2023-01-08  发布在  PHP
关注(0)|答案(1)|浏览(128)

我正在创建一个WordPress主题,我已经有一段时间没有这样做了,我遇到了一个关于移动的CSS的问题。
我将CSS文件嵌入到functions.php文件中:

function enqueue_my_custom_styles() {
      wp_enqueue_style( 'stylesheet', '/assets/main.css' );
  }
  add_action( 'wp_enqueue_scripts', 'enqueue_my_custom_styles');

这看起来工作得非常好,当我检查文件是否链接到浏览器时,它就显示出来了。然而,当我在移动的上查看时,我只能看到基本的HTML标记,这些标记嵌入在header.php文件中(我已经尝试过将CSS嵌入到header.php文件中,结果相同)
是有一个特定的功能我忽略了还是问题出在别的地方?谢谢。

62lalag4

62lalag41#

/* Some time css not working on specific mobile device because third party library impact on your current page or any wordpress plugin install on your website then so you can using media queries and set your target apply on specific device.  */

You can used different css for chrome , firefox , safari brower etc.

For more details visit below links
https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries

1. Css functionality is wp default option – so this is not theme related issue, if you are using any caching plugins or any other caching solutions clear them before checking on mobile.
2. Make sure to clean the mobile cache before checking (every time you make CSS changes)

相关问题