使用网格时,如何在我的网站底部放置页脚?

时间:2019-02-23 22:31:21

标签: html css css3 footer css-grid

我正在制作一个网站,并为自己的身体使用了网格。现在,我正在尝试为网站创建页脚,但是页脚正被放置在主体的右侧。

我认为问题可能出在我的容器上,尽管我不太确定...

$con = new PDO("mysql:host={$host};dbname={$db};charset={$charset}", $user, $pass);

$new_qry = "SELECT * FROM Contractors WHERE `Name` = 'John';";
$new_qry.= "SELECT * FROM Interns WHERE `Name` = 'Mike'";
$stmt = $con->prepare( $new_qry );
$stmt->execute();

while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
    extract($row);
    $new_lat = $row['Latitude'];
    $new_long = $row['Longitude'];
    .
    .
    .etc

}

我真的不知道该如何解决。有人可以帮我吗?

这是我的HTML和CSS:

.container {
display: grid;
grid-template-columns: 50% auto;
height: auto;
align-self: center;
margin: 0 65px;
height: 90% auto;
body,
html {
  height: 100%;
  margin: 0;
  width: 100%;
}

body {
  font-family: "Montserrat";
  display: grid;
  grid-template-columns: 100% auto;
  grid-template-rows: 90% auto;
  background-color: rgb(27, 27, 27);
  color: white;
}

.bg,
.bg2 {
  width: 100%;
  height: 100%;
  position: absolute;
}

.bg {
  -webkit-clip-path: polygon(66% 67%, 100% 0, 100% 100%, 0% 100%);
  clip-path: polygon(66% 67%, 100% 0, 100% 100%, 0% 100%);
  z-index: -1;
  background-color: #053970;
}

.bg2 {
  z-index: -2;
  background-color: #004288;
  -webkit-clip-path: polygon(49% 67%, 100% 0, 100% 100%, 0% 100%);
  clip-path: polygon(49% 67%, 100% 0, 100% 100%, 0% 100%);
}

.container {
  display: grid;
  grid-template-columns: 50% auto;
  height: auto;
  align-self: center;
  margin: 0 65px;
  height: 90% auto;
}

a {
  color: black;
}

a:visited {
  color: black;
}

ul {
  list-style-type: none;
  perspective: 1000px;
}

ul a li {
  display: grid;
  grid-template-columns: 20% auto;
  border-radius: 10px;
  padding: 15px;
  cursor: pointer;
  transform: rotateY(-30deg) rotateX(15deg);
  position: absolute;
  opacity: 0.8;
  border-bottom: 4px solid rgba(0, 0, 0, .2);
  mix-blend-mode: multiply;
  width: 500px;
}

ul a:nth-child(1) li {
  background: #a9cfe2;
  top: -105px;
  z-index: 2;
}

ul a:nth-child(2) li {
  background: #85b890;
  z-index: 1;
  top: 0px;
}

ul a:nth-child(3) li {
  background: #cca6a6;
  z-index: 0;
  top: 105px;
}

ul a li:hover {
  transform: rotateY(-22deg) rotateX(7deg) scale(1.05);
  transition: transform .45s ease-out;
  z-index: 3;
  mix-blend-mode: normal;
}

footer {
  height: 10%;
  width: 100%;
  background-color: #333;
  bottom: 0;
  left: 0;
  display: initial;
  float: bottom;
}

img {
  margin-top: 5;
  width: 70px;
}

h1 {
  font-size: 3em;
  margin-top: 0;
  margin-bottom: 0;
}

h2 {
  font-size: 2em;
  margin-top: 0;
}

#left>p {
  color: #aaa;
  line-height: 1.5em;
}

#right {
  margin-left: 15%;
}

1 个答案:

答案 0 :(得分:0)

Maybe Your Forgetting

grid-template-rows: auto 1fr auto;?

Check Out This Article Maybe It Might Help.

https://dev.to/niorad/keeping-the-footer-at-the-bottom-with-css-grid-15mf