首页 > 解决方案 > Heroku App not displaying same positioning/css as localhost

问题描述

I am having an issue with my locally hosted site having correct CSS/positioning but after it is deployed to Heroku it seems to lose some CSS. I am running mostly MERN Stack. I suspect it is going to be a problem relating to my node_modules but I have them in my git ignore and am not very knowledgable in that area. The best example I have is my About Us page. I've never encountered this issue and have found only info about Rails projects having this issue. I have tried uninstalling/re-installing bootstrap and added the CDN to the index.js file. Any help would be much appreciated.

Deployed Site Screen Cap

Locally Hosted Screen Cap

Updated Deployed Site Screen Cap

Updated Locally Hosted Screen Cap

UPDATE: Found this CSS library is very helpful and helped fix my wonky CSS in production. https://meyerweb.com/eric/tools/css/reset/

标签: cssnode.jsreactjsherokubootstrap-4

解决方案


可能是你的缓存问题。

由于 VH(视口高度)属性,这可能是一个问题。它会根据屏幕高度而变化。

  • 视口 = 浏览器窗口大小。如果视口宽 50 厘米,则 1vw = 0.5 厘米。

我刚刚看到你的代码,似乎你正在使用静态高度.about-wrapper

在您的情况下,您应该删除.about-wrapper选择器的高度属性。


推荐阅读