內容不足footer位於頁面底部-字節跳動筆試題

內容不足footer位於頁面底部

字節跳動前端面試題,大意如下:
1.頁面有三個模塊,heaer,content,footer
2.當頁面內容超出瀏覽器窗口時不顯示
2.當content不足以填充頁面時footer出現在頁面底部

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>cors</title>
</head>
<style>
    *{
        margin:0;
        padding:0;
    }
   html,body{
       width:100%;
       height:100%;
       overflow: hidden;
   }
   .header{
       width:100%;
       background-color:rgb(34, 156, 116);
   }
   .container{
       width:100%;
        min-height:100%;
       position: relative;
       
   }
   
   .content{
        width:100%;
        background-color:rgb(124, 238, 238);
   }
   .footer{
        width:100%;
       position: absolute;
       bottom:0;
       background-color:rgb(194, 194, 54);
   }
  
</style>
<body>
     <div class="container">
         <header class="header">header</header>
         <div class="content">content</div>
         <footer class="footer">footer</footer>
     </div>   
</body>
</html>

內容區高度不足
內容區高度不足內容區高度足夠
內容區高度足夠

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章