页脚重叠包装并在我的HTML页面上发布

时间:2018-04-29 01:56:57

标签: html css

我正在制作一项只能使用HTML / CSS制作网站的作业。我的帖子页面上的网站页脚有问题。页脚从我拥有的包装开始,并与另一个帖子重叠,也不适合身体。我将发送两个链接,其中一个帖子页面和其他CSS类和我正在使用的id!希望我能得到一些帮助!

以下是我正在使用的页面+ CSS的链接:

https://codepen.io/brumone/pen/wjgJBx Link

PS:我把整个CSS放在上面,所以看起来并不奇怪。

2 个答案:

答案 0 :(得分:0)

有两个问题 - 包装器的div标记未关闭 - footer css的位置已从absolute更改为static

* {
  box-sizing: border-box;
}

html{
  position: relative;
  min-height: 100%;
}

body{
  margin: 0;
  height: 100%;
}

.home{
    background-image: url("../imgs/imgburgerbg.jpg");
    background-repeat: no-repeat;
    background-size: cover;
}

.form-group{
  padding: 10px;
}
.msg-erro{
  color: red;
  font-size: 0.8em;
  font-style: italic;
}

header{
  padding: 1em;
  color: white;
  background-color: rgb(204, 36, 47);
  clear: left;
  text-align: center;
}

 .navbar ul {
   list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: rgb(204, 36, 47);
    text-align: center;
	}

.navbar li {
  display: inline-block;
  text-align: center;
	}

.navbar li a {
    display: inline-block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
	}

.navbar li a:hover:not(.active) {
  background-color: #111;
  text-align: center;
	}

.active {
    background-color: #4CAF50;
  }

#content{
  text-align: center;
  padding-top: 10%;
  text-shadow: 0px 4px 3px rgba(0, 0, 0, 0.4),
               0px 8px 13px rgba(0, 0 , 0, 0.1),
               0px 18px 23px rgba(0, 0, 0, 0.1);
  color: white;
}

hr{
  width: 400px;
  border-top: 1px solid #f8f8f8;
  border-bottom: 1px solid rgba(0,0,0,0.2);
}

footer {
  position: static;
  bottom: 0;
  width: 100%;
  height: 75px;
  text-align: center;
  color: white;
  background-color: rgb(204, 36, 47);
  }

input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid black;
  border-radius: 4px;
  resize: vertical;
}

label {
  padding: 12px 12px 12px 0;
  display: inline-block;
}

input[type=email] {
  width: 100%;
  padding: 12px;
  border: 1px solid black;
  border-radius: 4px;
  resize: vertical;
}

input[type=submit] {
    background-color: #4CAF50;
    color: white;
    padding: 12px 19px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    float: left;
}

input[type=submit]:hover {
    background-color: #45a049;
}

.form-container{
  border-radius: 5px;
    background-color: #f2f2f2;
    padding: 20px;
}

.col-25 {
  float: left;
  width: 25%;
  margin-top: 6px;
}

.col-75{
  float: left;
  width: 25%;
  margin-top: 6px;
}

.row:after {
    content: "";
    display: table;
    clear: both;
}

.wrapFooter{
  position: static;
  bottom: 0;
  width: 100%;
  height: 75px;
  text-align: center;
  color: white;
  background-color: rgb(204, 36, 47);
  font-size: small;
}

#wrapper {
  width: 600px;
  margin-left: auto;
  margin-right: auto;
  padding-top: 10px;
  overflow: auto;
}

.post {
  border-radius: 10px;
  padding: 5px;
  margin-bottom: 5px;
  background: #ffffff;
  border: 3px solid red;
}

.imgburger{
  height: 100%;
  width: 100%;
  object-fit: contain;
}
<html>
  <head>
    <meta charset="utf-8">
    <title>Reviews</title>
    <link rel="stylesheet" href="assets/css/style.css">
  </head>
  <body>

    <header>
      <h1>burgeReview</h1>
    </header>

    <div class="navbar">
        <nav>
          <ul>
                <li class="active"><a href="index.html">Home</a></li>
                <li><a href="about.html">Sobre</a></li>
                <li><a href="contato.html">Contato</a></li>
                <li><a href="post.html">Reviews</a></li>
          </ul>
        </nav>
      </div>

    <div id="wrapper">
      <div id="conteudo">
          <div class="post">
              <h2>Titulo</h2>
              <h5>28 de abril, 2018</h5>
              <img src="assets/imgs/burger1.jpeg" class="imgburger" alt="">
              <p>Great burger, really salty and</p>
          </div>
          <div class="post">
              <h2>Titulo</h2>
              <p>Great burger, really salty and</p>
          </div>
          <div class="post">
              <h2>Titulo</h2>
              <p>Great burger, really salty and</p>
          </div>
        </div>
</div>
        <footer>
          <h2>Copyright &copy; Daniel Brum</h2>
        </footer>

  </body>
</html>

答案 1 :(得分:0)

您需要对代码进行重大改进,但在此处codepen的链接 希望能帮助你。以下是页脚CSS

footer {
  width: 100%;
  height: 75px;
  text-align: center;
  color: white;
  background-color: rgb(204, 36, 47);
  }