难以使网站移动响应[关闭]

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了难以使网站移动响应[关闭]相关的知识,希望对你有一定的参考价值。

我有一些难以使这个网站(phil-ga-surge.sh)移动响应。由于它只是一个登陆页面,我并不是想让它变得太复杂,所以只是希望一切都在屏幕尺寸改变时就位。我确信这很简单,但对于我的生活,我无法理解这一点。我画的是空白。这是我到目前为止:

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

body, html {
  height: 100%;
  margin: 0;
}

.bgimg {
  background-image: url("https://res.cloudinary.com/dod6u4bjy/image/upload/v1536798847/water_kingdom_background.jpg");
  height: 100%;
  background-position: center;
  background-size: cover;
  position: relative;
  color: white;
  font-family: 'Merienda', cursive;
  font-size: 25px;
}

.nav {
  color: blue;
  text-decoration: none;
  list-style-type: none;
  display: flex;
  justify-content: space-between;
  width: 400px;
  padding-top: 10px;
}

.topleft {
  position: absolute;
  top: 0;
  left: 16px;
}

.header {
  color: white;
}

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

hr {
  margin: auto;
  width: 40%;
}

#h3 {
  color: rgba(255, 255, 255, 0.5);
  -webkit-animation: flash linear 4s infinite;
  animation: flash linear 4s infinite;
}
@-webkit-keyframes flash {
  0% {
    opacity: 4;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 4;
  }
}
@keyframes flash {
  0% {
    opacity: 4;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 4;
  }
}

a:hover {
  color: darkgrey;
}


.logo {
  margin-top: 25px;
  height: 100px;
}

a {
  text-decoration: none;
  color: darkblue;
}

footer {
  text-align: center;
  color: white;
  position: fixed;
  bottom: 0;
  width: 100%;
}


@media all and (max-width: 480px) {
  .nav {
    display:inline-block;
  }
  .header {
    width: 100%;
  }
body, html {
  width: 100%;
}

}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link href="https://fonts.googleapis.com/css?family=Architects+Daughter" rel="stylesheet">
  <link rel="stylesheet" href="style.css" type="text/css"
</head>

<body>

  <div class="bgimg">
    <div class="topleft">

      <nav class="nav">
        <li> <a href="https://raijinstudiosabout.carrd.co">Raijin Studios</li></a>
        <li><a href="https://thewaterkingbook.carrd.co">About the Book</li></a>

      </nav>

    </div>
    <div class="heading">
      <h1 class="header">Announcing:<br> The Water King</h1>

      <hr>
      <h3 id="h3"></h3>
    </div>

  </div>

  <footer>©Raijin Studios</footer>
<script src="javascript.js"></script>
</body>

</html>
答案

问题是你有一个未封闭的link标签:

<link rel="stylesheet" href="style.css" type="text/css"

把它改成这个:

<link rel="stylesheet" href="style.css" type="text/css" />
另一答案

我尽快用<link rel="stylesheet" href="style.css" type="text/css"取代<link rel="stylesheet" href="style.css" type="text/css" />

以上是关于难以使网站移动响应[关闭]的主要内容,如果未能解决你的问题,请参考以下文章

如何使当前的网站具有响应性? [关闭]

如何使页面仅在移动设备上响应[关闭]

如何使该网站专门针对移动屏幕做出响应?

使网站响应的标准媒体查询[重复]

如何使wordpress属性移动响应

提升移动设备响应式设计的8个建议