英文:
The interface is not displayed correctly
问题
下午/晚上好,我目前正在创建网站并决定测试其适应性。在计算机上一切正常:
但当我将它转移到手机上(Redmi Note 9 PRO 和 Samsung Galaxy J1),出现了以下情况:
由于某种原因,手机浏览器无法看到导入的样式和 JS。我有一个问题:如果我将其放在托管上,会是同样的情况吗?为什么手机看不到样式?
如果您需要元标记和文件路径,那么这是它们:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<link rel="shortcut icon" href="./img/favicon.svg" type="image/x-icon">
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/icons/bootstrap-icons.css">
<link rel="stylesheet" href="./css/style.css">
<!-- end snippet -->
我希望能得到为什么会发生这种情况的解释,提前感谢。
英文:
Good afternoon/evening, I am currently in the process of creating the website and decided to test its adaptability. Everything looks good on the computer:
But when I transferred it to the phone (Redmi Note 9 PRO and Samsung Galaxy J1), the following came out:
For some reason, the phone browser does not see the imported styles and JS. I have a questions: if I put it on hosting, will it be the same stuff? And why doesn't the phone see the styles?
If you need meta tags and file paths, then here they are:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<link rel="shortcut icon" href="./img/favicon.svg" type="image/x-icon">
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/icons/bootstrap-icons.css">
<link rel="stylesheet" href="./css/style.css">
<!-- end snippet -->
I hope to get an explanation of why this is happening, thank you in advance
答案1
得分: -1
我猜你正在直接打开你的文件,而你可能需要一个像这样的http服务器:https://www.npmjs.com/package/http-server
你可以让它监听0.0.0.0,然后你应该能够通过你的本地IP打开它。
英文:
I'm guessing you're opening your files directly, and that you might need a http server like this: https://www.npmjs.com/package/http-server
You can get it to listen to 0.0.0.0, and then you should be able to open it through your local IP.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论