简体   繁体   English

ReactJS 网页无法正确显示

[英]ReactJS Webpage not displaying correctly

I have just finished working on a webpage and decided to deploy in on GitHub Pages using Yarn.我刚刚完成了一个网页的工作,并决定使用 Yarn 在 GitHub Pages 上进行部署。 The problem is everything looked good when it was running on localhost but some things didn't display correctly on deployed version in my browser.问题是当它在本地主机上运行时一切看起来都很好,但是在我的浏览器中部署的版本上有些东西没有正确显示。

I tested it on browsers:我在浏览器上测试过:

  1. Google Chrome 86.0.4240.193谷歌浏览器 86.0.4240.193
  2. Safari 13.1 Safari 13.1

In both the same issue appeared.在两个相同的问题出现。 Here are some screenshots of comparison when running on localhost and online:下面是一些在 localhost 和在线运行时的对比截图:

Localhost:本地主机: 本地主机

Online:在线的: 在线的

On the second one there is a barely visible outline of my buttons.在第二个上,我的按钮几乎看不到轮廓。 I was thinking some of my CSS may have caused this so here is also my styling for these buttons:我在想我的一些 CSS 可能导致了这个,所以这里也是我对这些按钮的样式:

.button {
    width: 29vw;
    height: 40vh;
    margin-left: 1.5vw;
    margin-right: 1.5vw;
    border: 3px solid black;
    border-radius: 10px;
    outline: none;
    padding: none;
    cursor: pointer;   
    opacity: 70%;
    font-family: myFont;
    font-size: 6vh;
    color: black;
}

.button:hover {
    opacity: 100%;
    animation: swing 1s;
}

Any idea why is this happening?知道为什么会这样吗? Thank you for any help.感谢您的任何帮助。

After some time playing with my CSS I found what the problem was and was able to fix it.在玩我的 CSS 一段时间后,我发现了问题所在并能够修复它。 Indeed my initial thoughts were right and opacity was causing this problem was.事实上,我最初的想法是正确的,不透明度是导致这个问题的原因。

If anyone else has the same problem here is a quick fix.如果其他人有同样的问题,这里是一个快速解决方案。 Just change from:只需更改:

opacity: 70%;

to:到:

opacity: 0.7;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM