为我的页脚创建问题

时间:2016-02-11 00:31:35

标签: html footer doctype

我注意到每当我将<!DOCTYPE html>放在我的html文档上时,页脚就会消失。每当我验证时我都不会得到任何错误,所以我该如何解决这个问题呢?谢谢

页脚显示如下。

#footer {
  font-weight: bold;
  color: white;
  text-align: center;
  padding: 5px;
  position: fixed;
  left: 0;
  bottom: 20;
  width: 100%;
  background-color: gray;
  border: 2px solid blue;
}
<!DOCTYPE html>
<html>

<head></head>

<body>
  <div id="footer">
    <button onclick="myFunction()">Privacy/Disclaimer Statement</button>
    <script>
      function myFunction() {
        alert("David's Pet Store will never share any of your private information outside of its committee. The website builder is also protected from any incorrect information posted by a pet owner.");
      }
    </script>
    <br>David's Pet Store - 2016
    <br>
  </div>
</body>

</html>

1 个答案:

答案 0 :(得分:0)

这就是你需要的吗?你的代码是100%正确但你可能会忘记px以便出现问题尝试我的代码为0px attom或20px,因为你需要^ _ ^

#footer {
  font-weight: bold;
  color: white;
  text-align: center;
  padding: 5px;
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  background-color: gray;
  border: 2px solid blue;
}
<!DOCTYPE html>
<html>

<head></head>

<body>
  <div id="footer">
    <button onclick="myFunction()">Privacy/Disclaimer Statement</button>
    <script>
      function myFunction() {
        alert("David's Pet Store will never share any of your private information outside of its committee. The website builder is also protected from any incorrect information posted by a pet owner.");
      }
    </script>
    <br>David's Pet Store - 2016
    <br>
  </div>
</body>

</html>

或者你可以看到Fiddle px 上看到{<3}}