how to set footer at the bottom when there is no content

后端 未结 3 1686
暖寄归人
暖寄归人 2021-01-29 06:13



        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-29 06:54

    A) Footer is fixed:

    footer {
        background-color: skyblue;
        position:fixed;
        bottom: 0;
        width: 100%;
    }
    

    footer {
    	background-color: skyblue;
    	position:fixed;
    	bottom: 0;
    	width: 100%;
    }
    
    

    B) Footer is not fixed:

    body {
        height: 1200px;
        position: relative;
    }
    
    footer {
        background-color: skyblue;
        position:absolute;
        bottom: 0;
        width: 100%;
    }
    

    body {
      height: 1200px;
      position: relative;
    }
    
    footer {
      background-color: skyblue;
      position:absolute;
      bottom: 0;
      width: 100%;
    }
    
    

提交回复
热议问题