1

这是一个例子...... http://imgur.com/5mcCB

页面内容不多,所以高度很小。正文 BG 颜色填充了页面底部,甚至超过了页脚 - 最终看起来很荒谬......

当内容很小(用户屏幕上没有滚动条)时,如何使页脚颜色完成页面?我不想为每一页永久地制作一个巨大的页脚,因为那会分享可笑性。

谢谢。

4

1 回答 1

1

我会给正文和页脚相同的背景颜色,然后将您的“正文”背景颜色应用到正文本身内的包装元素。

<!DOCTYPE html>
<html>
  <head>
    <title>Alternative Background Method</title>
    <style>
      body, 
      body > footer {
        background: /* bgcolor */
      }
      #content {
        background: /* original body background color */
      }
    </style>
  </head>
  <body>
    <section id="content">
      <!-- main content --->
    </section>
    <footer>
      <!-- footer contents -->
    </footer>
    <!--

      Any visible space between the bottom of the viewport and the 
      footer element will have the same background as the footer
      element itself.

    -->
  </body>
</html>
于 2012-05-12T17:46:40.633 回答