簡體   English   中英

CSS 無法在移動設備上加載但在桌面上運行良好

[英]CSS not loading on mobile devices but working fine on desktop

我正在創建一個 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 標記和工作 Bootstrap 5.0,它嵌入在header.php文件中(我已經嘗試將 CSS 嵌入到 header.851945388 文件中,結果相同)

是否有我忽略的特定 function 或其他地方的問題? 謝謝你。

 /* 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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM