【问题标题】:Difficulty in making website mobile responsive [closed]使网站移动响应的困难[关闭]
【发布时间】:2019-02-28 12:14:09
【问题描述】:

我很难让这个网站 (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


    【解决方案1】:

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

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

    改成这样:

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

    【讨论】:

    • 没问题!我的回答解决了你的问题吗?
    • @P.Murtagh 当您说有人解决了您的问题时,最好接受他们的回答,因为您也可以回馈社区。​​span>
    • 你说得对,谢谢你让我知道。
    【解决方案2】:

    我将&lt;link rel="stylesheet" href="style.css" type="text/css" 替换为&lt;link rel="stylesheet" href="style.css" type="text/css" /&gt; 后一切正常

    【讨论】:

      猜你喜欢
      • 2022-11-17
      • 1970-01-01
      • 2013-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多