# 移动视图加载的HTML与桌面不同

**URL:** https://meta.discourse.org/t/mobile-view-loading-different-html-as-compared-to-desktop/259844
**Category:** Development
**Created:** [2023年三月29日 11:55 UTC](https://meta.discourse.org/t/mobile-view-loading-different-html-as-compared-to-desktop/259844 "2023-03-29T11:55:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Parul](https://avatars.discourse-cdn.com/v4/letter/p/5fc32e/32.png) [@Parul](https://meta.discourse.org/u/Parul)
#### Post date: [2023年三月29日 11:55 UTC](https://meta.discourse.org/t/mobile-view-loading-different-html-as-compared-to-desktop/259844/1 "2023-03-29T11:55:18Z")

</div>

我已经注册了 Discourse 的试用账户并创建了一个自定义主题。  
在桌面端运行正常，但在移动端却无法正常工作，加载的 HTML 也完全不同。

 ![imgonline-com-ua-twotoone-ApkHgSis7zAH6V](https://global.discourse-cdn.com/meta/original/4X/a/9/0/a90f334a907ac2891ba679354b068d9e91d5c65c.jpeg)

左侧是移动端视图，右侧是桌面端视图。

我检查了一些客户的设计（例如 Figma），桌面端和移动端显示效果相同。

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2023年三月29日 13:08 UTC](https://meta.discourse.org/t/mobile-view-loading-different-html-as-compared-to-desktop/259844/2 "2023-03-29T13:08:37Z")

</div>

移动版和桌面版视图对某些页面使用不同的 HTML 模板，因此您需要单独设置它们的样式。在您的主题中，您可以拥有特定于移动版或桌面版的样式表，主题 CSS 的结构在此处介绍：[Structure of themes and theme components](https://meta.discourse.org/t/structure-of-themes-and-theme-components/60848)

您也可以在桌面上切换移动版视图，以方便开发

> [@Johani](#):
>
> 您可以通过在 URL 末尾添加 `?mobile_view=1` 来在桌面设备上预览移动版视图（`?mobile_view=0` 可切换回桌面版）。
