页脚不会粘在移动版本的底部

Footer wont stick to bottom on mobile version

干草。 当您在移动设备上打开此页面时 phone 页脚不在页面底部。当我在浏览器上打开检查时,我看到该标签继续显示,而不是停在页脚上。我尝试在 CSS 文件中添加 HTML {height:100%;}HTML {max-height:100%;} 但没有任何反应。在图像上,您可以看到问题所在。 >这只发生在这个页面上,我在网站上的其他页面上没有这个问题。

手机版预览

这是我的代码:

CSS

.map-container {
  overflow: hidden;
  padding-bottom: 56.25%;
  position: relative;
  height: 0;
}

.map-container iframe {
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  position: absolute;
}

.navigacija-link {
  color: #dcfd50 !important;
  font-weight: 700;
  font-size: larger;
}

.navigacija-link:hover {
  color: white !important;
  font-weight: 700;
  font-size: larger;
  text-decoration: underline !important;
}

.navigacija-podlink {
  color: #dcfd50 !important;
  font-weight: 500;
  font-size: large;
}

.navigacija-podlink:hover {
  color: black !important;
  font-weight: 500;
  font-size: large;
  text-decoration: underline !important;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>Vijest | TK Pazin</title>
  <link href="css/style.css" rel="stylesheet" />
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

</head>

<body style="background-color: #dcfd50;">
  <nav class="navbar navbar-expand-lg fixed-top navbar-light" style="background-color: #ba3631;">
    <a class="navbar-brand" href="index.html">
      <img src="img/logo.jpg" width="50" height="50" class="d-inline-block align-top" alt="">
    </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavDropdown">
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="index.html">Novosti</a>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="pojedinacni-turniri.html">Pojedinačni turniri</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle navigacija-link" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    Rang liste
                </a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink" style="background-color: #ba3631;">
            <a class="dropdown-item navigacija-podlink" href="rang-liste/pojedinacni-turniri.html">Pojedinačni turniri</a>
            <a class="dropdown-item navigacija-podlink" href="rang-liste/piramida.html">Piramida</a>
          </div>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="o-klubu.html">O klubu</a>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="galerija.html">Galerija</a>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="kontakt.html">Kontakt</a>
        </li>
      </ul>
    </div>
    <span class="navbar-text">
        <b style="font: italic bold 2vw Georgia, serif; color: whitesmoke;">TK Pazin</b>
    </span>
  </nav>
  <div style="margin-bottom: 75px;"></div>
  <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
    <ol class="carousel-indicators">
      <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
    </ol>
    <div class="carousel-inner">
      <div class="carousel-item active">
        <img src="img/karosel/2.jpg" class="d-block w-100" alt="...">
      </div>
      <div class="carousel-item">
        <img src="img/karosel/3.jpg" class="d-block w-100" alt="...">
      </div>
      <div class="carousel-item">
        <img src="img/karosel/4.jpg" class="d-block w-100" alt="...">
      </div>
    </div>
    <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
      <span class="carousel-control-prev-icon" aria-hidden="true"></span>
      <span class="sr-only">Prethodni</span>
    </a>
    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
      <span class="carousel-control-next-icon" aria-hidden="true"></span>
      <span class="sr-only">Sljedeći</span>
    </a>
  </div>

  <!-- Page Content -->
  <div class="container">
    <div class="row">
      <div class="col-4" style="margin-top: 25px; max-width: 184px;"><a href="index.html" class="btn btn-info">Povratak na početnu stranicu</a></div>
    </div>
    <div class="row">
      <div class="col-12">
        <h1 class="my-4" style="text-align:center; color: #ba3631;">Vijest</h1>
      </div>
    </div>

    <div class="col-12 mb-4">
      <div class="card h-100">
        <a href="#"><img class="card-img-top" src="img/vijesti.jpg" alt="vijest"></a>
        <div class="card-body">
          <p class="card-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra euismod odio, gravida pellentesque urna varius vitae.</p>
          <h6>Izrađeno: 5.5.2016.</h6>
        </div>
      </div>
    </div>


    <!-- /.row -->

  </div>
  <!-- /.container -->
  <footer id="sticky-footer" class="py-4 bg-dark text-white-50">
    <div class="container text-center">
      <small>Rezervacija terena: <a href="tel:098-434-133" style="color:#ba3631; font-weight: 700; font-size:medium;">098 434 133</a></small>
      <br>
      <small>Copyright &copy; 2019 Tenis klub Pazin - Sva prava pridržana</small>
    </div>
  </footer>


  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>

</html>

将此元标记添加到 html 文件的标题部分。

<meta name="viewport" content="width=device-width, initial-scale=1.0">

请在css中添加此代码:

footer {
   position: absolute;
   bottom: 0;
   width: 100%;
}

为正文尝试此 flex-direction: column;,为页脚尝试此 margin-top: auto;

.map-container {
  overflow: hidden;
  padding-bottom: 56.25%;
  position: relative;
  height: 0;
}
body{
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
footer{
    margin-top: auto;
}

.map-container iframe {
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  position: absolute;
}

.navigacija-link {
  color: #dcfd50 !important;
  font-weight: 700;
  font-size: larger;
}

.navigacija-link:hover {
  color: white !important;
  font-weight: 700;
  font-size: larger;
  text-decoration: underline !important;
}

.navigacija-podlink {
  color: #dcfd50 !important;
  font-weight: 500;
  font-size: large;
}

.navigacija-podlink:hover {
  color: black !important;
  font-weight: 500;
  font-size: large;
  text-decoration: underline !important;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>Vijest | TK Pazin</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/style.css" rel="stylesheet" />
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

</head>

<body style="background-color: #dcfd50;">
  <nav class="navbar navbar-expand-lg fixed-top navbar-light" style="background-color: #ba3631;">
    <a class="navbar-brand" href="index.html">
      <img src="img/logo.jpg" width="50" height="50" class="d-inline-block align-top" alt="">
    </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavDropdown">
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="index.html">Novosti</a>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="pojedinacni-turniri.html">Pojedinačni turniri</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle navigacija-link" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    Rang liste
                </a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink" style="background-color: #ba3631;">
            <a class="dropdown-item navigacija-podlink" href="rang-liste/pojedinacni-turniri.html">Pojedinačni turniri</a>
            <a class="dropdown-item navigacija-podlink" href="rang-liste/piramida.html">Piramida</a>
          </div>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="o-klubu.html">O klubu</a>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="galerija.html">Galerija</a>
        </li>
        <li class="nav-item">
          <a class="nav-link navigacija-link" href="kontakt.html">Kontakt</a>
        </li>
      </ul>
    </div>
    <span class="navbar-text">
        <b style="font: italic bold 2vw Georgia, serif; color: whitesmoke;">TK Pazin</b>
    </span>
  </nav>
  <div style="margin-bottom: 75px;"></div>
  <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
    <ol class="carousel-indicators">
      <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
    </ol>
    <div class="carousel-inner">
      <div class="carousel-item active">
        <img src="img/karosel/2.jpg" class="d-block w-100" alt="...">
      </div>
      <div class="carousel-item">
        <img src="img/karosel/3.jpg" class="d-block w-100" alt="...">
      </div>
      <div class="carousel-item">
        <img src="img/karosel/4.jpg" class="d-block w-100" alt="...">
      </div>
    </div>
    <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
      <span class="carousel-control-prev-icon" aria-hidden="true"></span>
      <span class="sr-only">Prethodni</span>
    </a>
    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
      <span class="carousel-control-next-icon" aria-hidden="true"></span>
      <span class="sr-only">Sljedeći</span>
    </a>
  </div>

  <!-- Page Content -->
  <div class="container">
    <div class="row">
      <div class="col-4" style="margin-top: 25px; max-width: 184px;"><a href="index.html" class="btn btn-info">Povratak na početnu stranicu</a></div>
    </div>
    <div class="row">
      <div class="col-12">
        <h1 class="my-4" style="text-align:center; color: #ba3631;">Vijest</h1>
      </div>
    </div>

    <div class="col-12 mb-4">
      <div class="card h-100">
        <a href="#"><img class="card-img-top" src="img/vijesti.jpg" alt="vijest"></a>
        <div class="card-body">
          <p class="card-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra euismod odio, gravida pellentesque urna varius vitae.</p>
          <h6>Izrađeno: 5.5.2016.</h6>
        </div>
      </div>
    </div>


    <!-- /.row -->

  </div>
  <!-- /.container -->
  <footer id="sticky-footer" class="py-4 bg-dark text-white-50">
    <div class="container text-center">
      <small>Rezervacija terena: <a href="tel:098-434-133" style="color:#ba3631; font-weight: 700; font-size:medium;">098 434 133</a></small>
      <br>
      <small>Copyright &copy; 2019 Tenis klub Pazin - Sva prava pridržana</small>
    </div>
  </footer>


  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>

</html>