项目中页脚页面的CSS / HTML问题

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

仅在某些页面中页脚有问题。在主页中,我有以下内容:https://i.stack.imgur.com/itndn.png

在许多其他页面中,我是这样的:https://i.stack.imgur.com/nzzQd.jpg

我不知道为什么页脚只能在主页上工作。这是代码:main.hbs

<!DOCTYPE html>
<html lang="it">
  <head>
    <meta charset="UTF-8">
    <title>Blocco Note</title>
    <!-- LINK -->
    <link rel="stylesheet" href="https://bootswatch.com/4/cosmo/bootstrap.min.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
    <link rel="stylesheet" href="/css/main.css">
  </head>

  <body>
    {{> navigation }}
    <main class="container p-5">
      {{> messages }}
      {{> errors }}
      {{{ body }}}
    </main>
    {{> footer }}

    <!-- SCRIPT -->
    <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.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    <script language="javascript"> function emailCurrentPage() { window.location.href = "mailto:?subject=" + document.title + "&body=" + encodeURI(document.location); }</script>
  </body>
</html>

main.css

body {
  background: #4DB6FA;
  background: -webkit-linear-gradient(to right, #25A7FD, #4DB6FA);
  background: linear-gradient(to right, #25A7FD, #4DB6FA);
}

.logo {
  width: 50%;
}

.footer {
  position: relative;
  width: 100%;
  background-color: #2780E3;
  color: white;
}

.btn {
  border-radius: 8px;
}

.jumbotron {
  border-radius: 8px;
  box-shadow: 0px 0px 2px 0px grey;
}

#about .display-4 {
  text-align: center;
  margin-bottom: 30px;
}
#about .col-4 {
  background: white;
  box-shadow: 1px 1px 1px grey;
  border-radius: 8px;
}

.card {
  border-radius: 8px;
  box-shadow: 0px 0px 2px 0px grey;
  margin-bottom: 10px;
}

.card-text {
  border-radius: 8px;
  box-shadow: 0px 0px 1px 0px grey;
  text-align: center;
}
.card-header {
  border-radius: 8px;
  box-shadow: 0px 0px 2px 0px grey;
  margin-bottom: 10px;
  text-align: center;
  font-weight: bold;
}

.alert {
  border-radius: 8px;
}

footer.hbs

<div class="footer text-center py-3">© 2020 Copyright: Blocco Note</div>

为什么我有这个问题?我尝试设置位置:相对,底部:0px,左侧:0px,清除:均为,但没有用。

html css footer
1个回答
-1
投票

尝试像这样将margin-bottom添加到0

    .footer {
  position: relative;
  width: 100%;
  background-color: #2780E3;
  color: white;
margin-bottom
}
© www.soinside.com 2019 - 2024. All rights reserved.