[英]html div container doesn't take height by the content inside
為什么<div id = "container">
高度為433px? 我將此頁面設置為http://www.elektroninescigaretes.ym.lt/ ,當我安裝一個元素時,它顯示div只有433px,我想在頁腳上保留所有權利(c),所以我需要div具有所有頁面的高度不僅限於上部。
//index file
<?php include ("template/header.php"); ?>
<div id = "home_content"></div>
<?php include ("template/footer.php"); ?>
//header file
<!DOCTYPE html>
<html>
<head>
<link rel = "stylesheet" href = "media/styles/style.css" media = "screen">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>el Cigarai</title>
</head>
<body class = "<?php
$remove = array(".php", "/");
$url = $_SERVER['SCRIPT_NAME'];
$current_file = str_replace($remove, "", $url);
$current_page = explode('_', $current_file);
echo $current_page[0];
?>">
<div id = "container">
//footer file
</div>
</body>
</html>
/style file
#container{
position: relative;
margin: 0 auto;
width: 960px;
height: 100%;
}
#home_content{
position: absolute;
top: 294px;
right: 60px;
width: 960px;
height: 750px;
background-image: url('../images/woman.jpg');
background-repeat: no-repeat;
overflow: hidden;
}
按照您的風格:
html body{height: 100%;}
您已將高度設置為100%,這意味着如果您的內容增長到大於視口(或父容器)所表示的100%,它將不會增長。 嘗試使用
min-height:100%
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.