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

问题描述 投票:0回答:2

我有一些难以使这个网站(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>
html css mobile responsive-design frontend
2个回答
1
投票

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

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

把它改成这个:

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

1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.