Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS div拉伸_Html_Css - Fatal编程技术网

Html CSS div拉伸

Html CSS div拉伸,html,css,Html,Css,首先,我要实现的目标是: 我只是不能让内容div工作,因为我想它,当你得到太多的页面,div应该伸展太底部,如果没有足够的内容太填充它,如果有太多的内容,它应该按下页脚。以下是我目前掌握的情况: HTML 抱歉,如果它有点不清楚,我已经修补了很多,所以这段代码可能有点混乱。我一直盯着它看,它在我的脑海里开始变得模糊起来 不管怎样,如果你有任何见解,我将不胜感激 耶一两年后回到html+css耶耶为了方便起见,我只想看看 将#内容设置为具有与所需效果相似的背景图像 您可能还想查看一个,看看这是否

首先,我要实现的目标是:

我只是不能让内容div工作,因为我想它,当你得到太多的页面,div应该伸展太底部,如果没有足够的内容太填充它,如果有太多的内容,它应该按下页脚。以下是我目前掌握的情况:

HTML

抱歉,如果它有点不清楚,我已经修补了很多,所以这段代码可能有点混乱。我一直盯着它看,它在我的脑海里开始变得模糊起来 不管怎样,如果你有任何见解,我将不胜感激


一两年后回到html+css

为了方便起见,我只想看看

将#内容设置为具有与所需效果相似的背景图像


您可能还想查看一个

,看看这是否适合您:即里程数可能会有所不同(使用“最小高度”属性)。如果您确实需要将页脚精确定位在浏览器窗口的底部,并拉伸内容div,我建议您根据需要使用JS解决方案来计算各种高度

我已经检查了它们的螺栓,实际上我在一个点上植入了粘脚,但又取出了,我想我可以把它放回去。但问题在于内容部门。我无法让人造柱工作,因为div太大了。它没有考虑页眉的大小或其他什么,给了页面一个滚动条,在div中没有任何内容。我真的需要页脚延伸到底部,有没有指向JS解决方案的链接?我没想到会这么复杂。我在js中添加了很多注释来解释我的思考过程,但实际上,这只是jQuery/JSQuery的几行代码。谢谢!这真是奇迹!我本来打算使用jQuery,所以没问题,我还添加了一个小动画;)非常感谢!
<!DOCTYPE HTML>
<html>
<head>
 <title>site</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="container">
<div id="headerBG"></div>
<div id="header"></div>
<div id="content">
 <div id="contentTop"></div>
 <div id="contentCenter"></div>
</div>
<div id="footerBG"></div>
</div>
</body>
</html>
html,body{ height: 100%; margin: 0; padding: 0; }

body{
background-image:url('images/bg.png');
background-repeat:repeat;
}

#container{
position: absolute;
background-color: green;
height: 100%;
width: 100%;
}

#headerBG{
position: absolute;
background-image:url('images/header_bg.png');
background-repeat:repeat-x;
height: 297px;
width: 100%;
}

#header{
position: relative;
margin-left: auto;
margin-right: auto;
background-color: black;
width: 780px;
height: 200px;
}

#content{
position:relative;
margin-left: auto;
margin-right: auto;
width:780px;
height:70%;
}

#contentTop{
width:780px;
height:30px;
background-image:url('images/content_top.png');
background-repeat: no-repeat;
}

#contentCenter{
width:780px;
height:100%;
background-image:url('images/content_bg.png');
background-repeat: repeat-y;
}

#footerBG{
position: absolute;
bottom:0px;
background-image:url('images/footer_bg.png');
background-repeat:repeat-x;
width: 100%;
height: 144px;
}