简体   繁体   中英

html div container doesn't take height by the content inside

Why <div id = "container"> has height of 433px? I make this page http://www.elektroninescigaretes.ym.lt/ and when I instect an element it shows me div has only 433px and I want to make on footer All rights reserved (c) stuff, so I need div to have height of all page not only of the upper part.

//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%;}

You have a height of 100% set, this means if your content grows larger than the 100% represented by the viewport (or parent container), it will not grow. Try using

min-height:100%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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