亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

利用CSS使footer固定在頁面底部的實例代碼

  發(fā)布時間:2016-05-13 09:15:02   作者:佚名   我要評論
下面小編就為大家?guī)硪黄肅SS使footer固定在頁面底部的實例代碼。小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

1. HTML基本結(jié)構(gòu)

XML/HTML Code復(fù)制內(nèi)容到剪貼板
  1. <!DOCTYPEhtml>  
  2.   
  3. <htmlxmlnshtmlxmlns="http://www.w3.org/1999/xhtml">  
  4.   
  5. <headrunatheadrunat="server">  
  6.   
  7.     <title>layout</title>  
  8.   
  9. </head>  
  10.   
  11. <body>  
  12.   
  13.     <divclassdivclass="header">  
  14.   
  15.         <h1>head of your website.</h1>  
  16.   
  17.     </div>  
  18.   
  19.     <divclassdivclass="wrapper">  
  20.   
  21.         <divclassdivclass="content">  
  22.   
  23.             <h2>Your website content here.</h2>  
  24.   
  25.             <scripttypescripttype="text/javascript">  
  26.   
  27.                 for(var i = 0; i<100;i++){   
  28.   
  29.                     document.write(i + "<br />");   
  30.   
  31.                 }   
  32.   
  33.             </script>  
  34.   
  35.         </div>  
  36.   
  37.         <divclassdivclass="clear"><!-- 必不可少 --></div>  
  38.   
  39.     </div>  
  40.   
  41.     <divclassdivclass="footer">  
  42.   
  43.         <div><h1>  
  44.   
  45.             Copyright (c) 2012</h1></div>  
  46.   
  47.     </div>  
  48.   
  49. </body>  
  50.   
  51. </html>  
  52.   

2. CSS樣式

CSS Code復(fù)制內(nèi)容到剪貼板
  1. <styletype="text/css">   
  2.   
  3.         *{   
  4.   
  5.             margin: 0;/* 把默認(rèn)值都設(shè)為0 */  
  6.   
  7.         }   
  8.   
  9.         html, body   
  10.   
  11.         {   
  12.   
  13.             height: 100%;   
  14.   
  15.             width:85%;   
  16.   
  17.             margin:0auto;/* 居中 */  
  18.   
  19.         }   
  20.   
  21.            
  22.   
  23.         .header   
  24.   
  25.         {   
  26.   
  27.             height:100px;   
  28.   
  29.             background-color:Fuchsia;   
  30.   
  31.         }   
  32.   
  33.            
  34.   
  35.         .wrapper   
  36.   
  37.         {   
  38.   
  39.             min-height: 100%;/* IE6 hack*/  
  40.   
  41.             heightauto!important;/* height優(yōu)先級 */  
  42.   
  43.             height: 100%;   
  44.   
  45.             margin: 0auto-4em;/* 負值必須等于footer的高度 */  
  46.   
  47.         }   
  48.   
  49.            
  50.   
  51.         .content  
  52.   
  53.         {   
  54.   
  55.             background-color:Silver;   
  56.   
  57.         }   
  58.   
  59.            
  60.   
  61.         .clear/* 清除浮動 */  
  62.   
  63.         {   
  64.   
  65.             height: 4em; /* clear的height必須和footer的值樣高 */  
  66.   
  67.             clear:both;   
  68.   
  69.         }   
  70.   
  71.            
  72.   
  73.         .footer   
  74.   
  75.         {   
  76.   
  77.             height: 4em;   
  78.   
  79.             background-color:Aqua;   
  80.   
  81.         }   
  82.   
  83.     </style>   

以上這篇利用CSS使footer固定在頁面底部的實例代碼就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • CSS實現(xiàn)footer“吸底”效果

    我們經(jīng)常會遇到這樣的問題:如何用css來實現(xiàn)底部元素可“粘住底部”的效果,對于“粘住底部”,本篇文章就來介紹一下。非常具有實用價值,需要的朋友可以參考下
    2018-10-10
  • 詳解CSS五種方式實現(xiàn)Footer置底

    本篇文章主要介紹了詳解CSS五種方式實現(xiàn)Footer置底,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-03-16
  • html的footer置于頁面最底部的簡單實現(xiàn)方法

    下面小編就為大家?guī)硪黄猦tml的footer置于頁面最底部的簡單實現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-05-13
  • 詳解HTML5將footer置于頁面最底部的方法(CSS+JS)

    這篇文章主要介紹了詳解HTML5將footer置于頁面最底部的方法(CSS+JS)的相關(guān)資料,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-10-11

最新評論