繁体   English   中英

html div容器的内容不占高度

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM