<delect id="sj01t"></delect>
  1. <em id="sj01t"><label id="sj01t"></label></em>
  2. <div id="sj01t"></div>
    1. <em id="sj01t"></em>

            <div id="sj01t"></div>

            頁腳始終保持在頁面底部的網頁布局方法

            時間:2025-11-10 05:54:36 網頁設計

            頁腳始終保持在頁面底部的網頁布局方法

              導語:用CSS創建一個高度自適應布局,如何保證頁腳(footer)在內容不超過一屏的情況下始終保持在布局最下方是一個比較頭疼的事。下面就由百分網小編為大家介紹一下頁腳始終保持在頁面底部的網頁布局方法,希望對大家能有所幫助。

              步驟:

              1、為了讓瀏覽器識別高度100%我們需要先給 html 和 body 加上一個高度值,同時清除所有元素的 margin 和 padding。順便提一下,經過我的測試,html 和 body 的 height: 100%; 等于整個瀏覽器窗口的總高度,無論內容是否超過一屏。而它們下一級子元素 height: 100%; 則等于第一屏的高度。如何,是不是有點不好理解?

              * {

              margin: 0;

              padding: 0;

              }

              html, body {

              height: 100%;

              }

              2、因為上面提到的問題,所以為了讓布局自適應高度,我們要加上 min-height: 100%;,雖然IE不支持這個屬性但是IE的 height: 100%; 有同樣的作用:

              #wrapper {

              min-height: 100%;

              }

              * html #wrapper {

              height: 100%;

              }

              這樣,一個最簡單的最小高度滿一屏的自適應布局就做好了。為了便于查看,我加了一些寬度和背景色修飾,如下:

              * {

              margin: 0;

              padding: 0;

              }

              html, body {

              height: 100%;

              text-align: center;

              font: 12px/1.4 Verdana, sans-serif;

              background: #f00;

              }

              #wrapper {

              width: 770px;

              min-height: 100%;

              background: #ccc;

              margin: auto;

              text-align: left;

              }

              * html #wrapper {

              height: 100%;

              }

              <!DOCTYPE html PUBLIC "-/pic/pic/pic/pic/TR/xhtml1/DTD/xhtml1-strict.dtd">

              <html xmlns="/pic/1999/xhtml">

              <head>

              <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

              <title>jzxue.com-建站學</title>

              <style type="text/css">

              /*<![CDATA[*/

              * {

              margin: 0;

              padding: 0;

              }

              html, body {

              height: 100%;

              text-align: center;

              font: 12px/1.4 Verdana, sans-serif;

              background: #F00;

              }

              #wrapper {

              width: 770px;

              min-height: 100%;

              background: #ccc;

              margin: auto;

              text-align: left;

              }

              * html #wrapper {

              height: 100%;

              }

              #header {

              background: Green;

              height: 40px;

              }

              #sidebar {

              float: left;

              width: 200px;

              background: Gray;

              }

              #content-box {

              float: right;

              width: 570px;

              background: Olive;

              }

              #footer {

              height: 50px;

              background: Background;

              width:770px;

              margin: auto;

              }

              /*]]>*/

              </style>

              </head>

              <body>

              <p id="wrapper">

              <p id="header">此處顯示  id "header" 的內容</p>

              <p id="content-box">此處顯示  id "content-box" 的內容</p>

              <p id="sidebar">此處顯示  id "sidebar" 的內容</p>

              </p>

              <p id="footer">此處顯示  id "footer" 的內容</p>

              </body>

              </html>

            【頁腳始終保持在頁面底部的網頁布局方法】相關文章:

            網頁設計布局方法01-31

            網頁設計中防止頁面被撐開的方法03-18

            網頁的排版與布局08-13

            網頁設計的布局12-20

            網頁布局方式12-14

            網頁布局基礎09-06

            wps文字如何布局頁面08-23

            網站制作頁腳如何自適應布局03-08

            交互頁面網頁設計09-06

            <delect id="sj01t"></delect>
            1. <em id="sj01t"><label id="sj01t"></label></em>
            2. <div id="sj01t"></div>
              1. <em id="sj01t"></em>

                      <div id="sj01t"></div>
                      黄色视频在线观看