【问题标题】:Undefined white space on mobile version of site移动版网站上未定义的空白区域
【发布时间】:2022-01-18 11:31:43
【问题描述】:

我正在为我的大学编写一个项目,我们正在创建一个网站。我在移动版本中的某些页面底部有多余的空白区域。

我知道这是一个常见的错误,我已经用谷歌搜索了这个问题并尝试了各种方法,但它在我剩下的两个页面上不起作用。

它实际上解决了某些页面上的问题,但是对于这两个它不起作用,我不知道为什么。 } 在我的 CSS 顶部,并尝试删除 max-height 100 vh,但不,不起作用。

如果有人可以帮助我将不胜感激。

GitHub上的代码链接:github

页面的 HTML CSS:css link

【问题讨论】:

标签: html css frontend


【解决方案1】:

在这里找不到任何空白

html,body {
  width: 100%;
  height: 100%;
  margin: 0px;
  padding: 0px;
  overflow-y: hidden;
}




* {
    margin: 0;
    padding: 0;
    font-family: "Lora", serif;
  }
  
  .registration {
    display: flex;
    justify-content: center;
    visibility: hidden;
  }
  .icons-test {
    display: none;
    visibility: hidden;
  }
  
  .header {
    min-height: 100vh;
    width: 100%;
    background-image: linear-gradient(rgba(4, 9, 30, 0.7), rgba(4, 9, 30, 0.7)),
      url(images/pozadina.jpg);
    background-position: center;
    background-size: cover;
    position: relative;
  }
  label.logo {
    color: white;
    font-size: 35px;
    line-height: 80px;
    padding: 0 0px;
    font-weight: bold;
  }
  nav {
    display: flex;
    padding: 2% 6%;
    justify-content: space-between;
    align-items: center;
  }
  
  .nav-links {
    flex: 1;
    text-align: right;
  }
  
  .nav-links ul li {
    list-style: none;
    display: inline-block;
    padding: 8px 12px;
    position: relative;
  }
  .nav-links ul li a {
    text-decoration: none;
    color: #fff;
    font-size: 13px;
  }
  .nav-links ul li::after {
    content: "";
    width: 0%;
    height: 2px;
    background: #ee82ee;
    display: block;
    margin: auto;
    transition: 0.5s;
  }
  
  .nav-links ul li:hover::after {
    width: 100%;
  }

  
  

  * {
    margin: 0;
    padding: 0;
    font-family: "Lora", serif;
  }
  
  .registration {
    display: flex;
    justify-content: center;
    visibility: hidden;
  }
  .icons-test {
    display: none;
    visibility: hidden;
  }
  
  .header {
    min-height: 100vh;
    width: 100%;
    background-image: linear-gradient(rgba(4, 9, 30, 0.7), rgba(4, 9, 30, 0.7)),
      url(images/pozadina.jpg);
    background-position: center;
    background-size: cover;
    position: relative;
  }
  label.logo {
    color: white;
    font-size: 35px;
    line-height: 80px;
    padding: 0 0px;
    font-weight: bold;
    padding-bottom: 30px;
  }
  nav {
    display: flex;
    padding: 2% 6%;
    justify-content: space-between;
    align-items: center;
  }
  
  .nav-links {
    flex: 1;
    text-align: right;
  }
  
  .nav-links ul li {
    list-style: none;
    display: inline-block;
    padding: 8px 12px;
    position: relative;
  }
  .nav-links ul li a {
    text-decoration: none;
    color: #fff;
    font-size: 13px;
  }
  .nav-links ul li::after {
    content: "";
    width: 0%;
    height: 2px;
    background: #ee82ee;
    display: block;
    margin: auto;
    transition: 0.5s;
  }
  
  .nav-links ul li:hover::after {
    width: 100%;
  }
  .text-box {
    width: 90%;
    color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
  }
  
  .text-box h1 {
    font-size: 62px;
  }
  
  .text-box p {
    margin: 10px 0 40px;
    font-size: 14px;
    color: #fff;
  }
  
  .hero-btn {
    display: inline-block;
    text-decoration: none;
    color: #fff;
    border: 2px solid #fff;
    padding: 15px 34px;
    font-size: 13px;
    background: transparent;
    position: relative;
    cursor: pointer;
  }
  .hero-btn:hover {
    border: 1px solid #800080;
    background: #800080;
    transition: 1s;
  }
  
  nav.fa {
    display: none;
  }
  
  @media (max-width: 700px) {
    .text-box h1 {
      font-size: 20px;
    }
    .nav-links ul li {
      display: block;
    }
    .hero-btn {
      display: block;
    }
    .nav-links {
      position: absolute;
      background: #800080;
      height: 100vh;
      width: 200px;
      top: 0;
      right: -200px;
      text-align: left;
      z-index: 2;
    }
  
    nav.fa {
      display: block;
      color: #fff;
      margin: 10px;
      font-size: 21px;
      cursor: pointer;
    }
    .nav-links ul {
      padding: 30px;
    }
    .icons-test {
      display: block;
      visibility: visible;
    }

    p {
      justify-content: left;
    }

  }

  

.text-box {
    font-weight: 700;
    padding: 40px;
}



/*-----popup form------*/
.text {
  color: #000000;
}

.label-form {
  color: #000000;
}

.container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.container {
  background: #fff;
  width: 410px;
  padding: 30px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.container .text {
  font-size: 35px;
  font-weight: 600;
  text-align: center;
}

.container form .data {
  width: 100%;
  margin: 40px 0;
}

form.data label {
  font-size: 18px;
}

form.data input {
  height: 100%;
  width: 100%;
  padding-left: 10px;
  font-size: 17px;
  /*------border: 1px solid lightgrey;-----*/
}

form .btn {
  margin: 30px 0;
  height: 45px;
  width: 100%;
  overflow: hidden;
  position: relative;
}

form .btn .inner {
  height: 100%;
  width: 300%;
  left: -100%;
  position: absolute;
  z-index: -1;
  background: -webkit-linear-gradient(right, #56d8e4, #9f01ea);
  transition: all 0.4s;
}

form .btn button {
  height: 100%;
  width: 100%;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
}

form .btn:hover .inner {
  left: 0;
}

form .forgot-pass {
  margin-top: -8px;
}

form .data input:focus {
  border-color: #3498db;
  border-bottom-width: 2px;
}

form .forgot-pass a {
  color: #3498db;
  text-decoration: none;
}

form .forgot-pass a:hover {
  text-decoration: underline;
}

form .signup-link {
  text-align: center;
}

form .signup-link a {
  color: #3498db;
  text-decoration: none;
}

form .signup-link a:hover {
  text-decoration: underline;
}

.container .close-btn {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 18px;
  cursor: pointer;
}

.container .close-btn:hover {
  color: #3498db;
}

.show-btn {
  background: #fff;
  padding: 10px 20px;
  font-size: 20px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}

#show:checked ~ .container {
  display: block;
}

input [type="checkbox"] {
  display: none;
}

.modal-register {
  position: fixed;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  width: 100vw;
  height: 100vh;
  flex-direction: column;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5063;
  display: none;
  pointer-events: none;
}

.modal-register-active {
  display: flex;
  pointer-events: inherit;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <script src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" data-auto-replace-svg="nest">

    </script>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lora:ital,wght@1,600&display=swap" rel="stylesheet">
    <title>SmartLearn</title>
</head>
<body>
    <section class="header">
        <nav>
            <a href="index.html" style="text-decoration: none;"><label class="logo"> SmartLearn  </label> </a>
            <div class="nav-links">
                <span class="icons-test"><i class="fa fa-times"></i></span>

                <ul>
                    
                       
                    <a href="shopping cart.html"><li class="korpa"><i class="fa fa-shopping-cart"></i></li> </a>     
                    <li> <a href=""> KURSEVI </a></li>
                    <li> <a href=""> KATEGORIJE </a></li>
                    <li> <a href=""> O NAMA </a></li>
                    <li> <a href=""> KONTAKT </a></li>
                    <li class="login" class="show-btn" id="show"><a href="">PRIJAVITE SE</a></li>
    

                </ul>

                <span class="icons-test"><i class="fa fa-bars"></i></span>

            </div>
        </nav>
        <div class="text-box">
            <h1> Podaci o korisniku </h1>
            <img src="images/user1.jpg">
             <p> Korisnicko ime: </br>
                Lozinka:  </br>
                Mejl: </br>
                Ime: </br>
                 Prezime: </br>
                Adresa: </br>
                Datum rodjenja : </p>
    </p>
             





           
        </div>
    </section>
    <div class="center modal-register">

        <div class="container">
            <label for="show" class="close-btn fas fa-times"></label>
            <div class="text"> Prijava </div>
            <form action="#">
                <div class="data">
                    <label class="label-form"> Korisnicko ime </label>
                    <input type="text" required>
                    <div class="data">
                        <label class="label-form" required> Lozinka </label>
                        <input type="password">
                </div>
                <div class="forgot-pas"><a href="#"> Forgot password</a> </div>
                <div class="btn">
                    <div class="inner"></div>
                    <button type="submit">Login </button>
                </div>
                <div class="signup-link">Niste clan? <a href="#"> Registrujte se </a></div>
            </form>
        </div>
    </div>

</body>
</html>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-02
    • 1970-01-01
    相关资源
    最近更新 更多