Не стилизованный контент появляется на Chrome - PullRequest
0 голосов
/ 07 августа 2020

enter image description here

Final Edit: I've found the test website on the course. Chrome renders really weird on start. Safari, Firefox, IE works fine. I guess this is about Chrome after all. Don't know that I can do about it. Here is the test website if you want to try it yourself: https://natours.netlify.app/

Я прошел курс на Udemy и заметил, что моя кнопка мигает при перезагрузке, но это происходит только на Chrome. В чем может быть причина этого? Я не думаю, что это связано с кодом, поскольку он отлично работает на Edge, IE и Firefox.

Изменить: вот файлы HTML и CSS. Я попытался открыть файл HTML itsel / используя express для его сервера, но все равно без разницы.

/*
    COLORS:
    
    Light green: #7ed56f
    Medium green: #55c57a
    Dark green: #28b485
    
    color: #fc5764
     anothercolor #fa78ca
    
    */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Lato", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: #777;
  padding: 30px;
  overflow-x: hidden;
}

.header {
  height: 95vh;
  background-image: linear-gradient( to right, rgba(126, 213, 111, 0.8), rgba(40, 180, 133, 0.8)), url(../img/hero.jpg);
  background-size: cover;
  background-position: top;
  position: relative;
  clip-path: polygon(0 0, 100% 0, 100% 70vh, 0 100%);
}

.logo-box {
  position: absolute;
  top: 40px;
  left: 40px;
}

.logo {
  height: 35px;
}

.text-box {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.heading-primary {
  color: #fff;
  text-transform: uppercase;
  backface-visibility: hidden;
  margin-bottom: 60px;
}

.heading-primary-main {
  display: block;
  font-size: 60px;
  font-weight: 400;
  letter-spacing: 35px;
  animation-name: moveInLeft;
  animation-duration: 1s;
  animation-timing-function: ease-out;
}

.heading-primary-sub {
  display: block;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 17.4px;
  animation-name: moveInRight;
  animation-duration: 1s;
  animation-timing-function: ease-out;
}

@keyframes moveInLeft {
  0% {
    opacity: 0;
    transform: translateX(-100%);
  }
  80% {
    transform: translateX(10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0%);
  }
}

@keyframes moveInRight {
  0% {
    opacity: 0;
    transform: translateX(100%);
  }
  80% {
    transform: translateX(-10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0%);
  }
}

@keyframes moveInBottom {
  0% {
    opacity: 0;
    transform: translateY(100%);
  }
  100% {
    opacity: 1;
    transform: translateY(0%);
  }
}

.btn:link,
.btn:visited {
  text-transform: uppercase;
  text-decoration: none;
  padding: 15px 40px;
  display: inline-block;
  border-radius: 100px;
  transition: all .2s;
  position: relative;
  backface-visibility: hidden;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(-1px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.btn-white {
  background-color: #fff;
  color: #777
}

.btn::after {
  content: "";
  display: inline-block;
  height: 100%;
  width: 100%;
  border-radius: 100px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  transition: all .4s;
}

.btn-white::after {
  background-color: #fff;
}

.btn:hover::after {
  transform: scaleX(1.4) scaleY(1.6);
  opacity: 0;
}

.btn-animated {
  animation-name: moveInBottom;
  animation-duration: 1s;
  animation-timing-function: ease-out;
  animation-fill-mode: backwards;
}
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet">

<header class="header">
  <div class="logo-box">
    <img src="img/logo-white.png" alt="Logo" class="logo">
  </div>
  <div class="text-box">
    <h1 class="heading-primary">
      <span class="heading-primary-main">Outdoors</span>
      <span class="heading-primary-sub">is where life happens</span>
    </h1>
    <a href="#" class="btn btn-white btn-animated">Discover our tours</a>
  </div>
</header>

Ответы [ 2 ]

0 голосов
/ 07 августа 2020

По-видимому, это ошибка последней версии Chrome. Добавление фиктивного тега скрипта сразу после его исправления в теле.

<body>
    <script>0</script>
    ...content...
</body>
0 голосов
/ 07 августа 2020

Возможная проблема

clip-path: polygon(0 0, 100% 0, 100% 70vh, 0 100%);

clip-path работает с %, я не нашел ничего про vh поддержка.

Каждый пользовательский агент браузера может решить эту проблему по-своему

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...