Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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 我的页脚DIV将不会位于页面底部_Html_Css_Footer - Fatal编程技术网

Html 我的页脚DIV将不会位于页面底部

Html 我的页脚DIV将不会位于页面底部,html,css,footer,Html,Css,Footer,我有一个页脚分区,这只是一个纯色,我想坐在底部以外的我的容器分区,这是所谓的'mainhome'。我想它延伸整个网站。它一直放在我的横幅上——我现在在代码中迷失了方向,所以也许我错过了一些小东西 先谢谢你 我的HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml

我有一个页脚分区,这只是一个纯色,我想坐在底部以外的我的容器分区,这是所谓的'mainhome'。我想它延伸整个网站。它一直放在我的横幅上——我现在在代码中迷失了方向,所以也许我错过了一些小东西

先谢谢你

我的HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />

</head>

<body>
<div class="mainhome">
    <div class="header">
      <div class="menubutton-leftside" style="margin-right:23px"><h2>home</h2></div>
      <div class="menubutton-leftside" style="margin-right:20px"><h2>about</h2></div>
      <div class="menubutton-leftside" style="margin-right:30px"><h2>portfolio</h2></div>
      <div class="menubutton-leftside" style="margin-right:27px"><h2>contact</h2></div>
        <div class="logo"><img src="images/es-logo.png" width="170" height="170" /></div> 
      <div class="menubutton-rightside" style="margin-left:17px"><h2>print</h2></div>
      <div class="menubutton-rightside" style="margin-left:25px"><h2>digital</h2></div>
      <div class="menubutton-rightside" style="margin-left:38px"><h2>illustration</h2></div>
      <div class="menubutton-rightside" style="margin-left:20px"><h2>brand</h2></div>
  </div>
        <div class="mainimage">
        <div id="slider_container">
  <div id="slides">
                <img src="images/slider/emmasteed.png" alt="Emma Steed Graphic Art and Web Design" />
                <img src="images/slider/graphicdesign-desk.png" alt="Emma Steed Graphic Art and Web Design" />
  </div>
</div>

    <div class="bluebar"></div>
        <div class="largemenubutton" style="margin-right:36px"><img src="images/portfolio.png" /></div>
        <div class="largemenubutton" style="margin-right:36px"><img src="images/getintouch.png" /></div>
        <div class="largemenubutton"><img src="images/aboutme.png" /></div>
        </div></div>
        <div class="footer"></div>
</body>
</html>

它看起来不像。nameimage需要绝对定位,但它取决于您希望它做什么。粗略的例子:。

如果你总是希望它处于最底部,那么最简单的方法就是给它一个固定的位置。将以下内容添加到页脚的CSS中。(您可能还必须将主体上的高度和宽度设置为100%)


我将其放置在absalute位置,因为它只是在页眉的下方,因为它有一个阴影()是不是删除了使页脚固定的absalute?是的,删除了文档流中的绝对puts
.mainimage
,使页脚保持在其下方。要恢复重叠,请在
.mainimage
上尝试负边距,例如:。请记住,这只是将页脚放在
.main image
下面。如果
.mainimage
#slider_container
中的内容高度动态变化,则页脚将上下移动以保持在其下方。我最喜欢的网站是了解这类事情的不同方法。谢谢——读了这篇文章后,我确实觉得‘当然可以!’然而,在Dreamweaver中,它仍然位于我的“主图像”的顶部,而在浏览器中,它现在位于图像的底部,而不是最底部。现在我的页脚为:。页脚{高度:61px;宽度:100%;背景色:#334d5c;位置:绝对;底部:0px;}HTML:在尝试了这个之后-这并不是我想要的理想的屏幕大小,我可以理解为什么它现在位于我的其他图像之上,我只希望它位于我页面的最底部,如果这有意义的话,它不总是可见的。嗨,这里,最后一件事,确保在css中为html和正文设置了100%高度和100%宽度,否则正文或html页面实际上不会延伸到页面的末尾。
@charset "UTF-8";
/* CSS Document */

body {
    background-image:url(images/header-background.png);
    background-repeat:repeat-x;
    margin:0;
    padding:0;
}

.mainhome {
    width: 855px;
    margin-top: 0;
    margin-right: auto;
    margin-bottom: 0;
    margin-left: auto;
}

.header {
    height: 236px;
    background-image:url(images/header-background.png);
    background-repeat:repeat-x;
    clear:left;
}

.mainimage {
    width: 855px;
    height: 423px;
    background-color:#0C9;
    position:absolute;
    top:220px;
    float:left;
    z-index:-1;
}

#slider_container {
        width:855px;
        height:423px;
        overflow:hidden;
}

.bluebar {
    width: 855px;
    height: 16px;
    background-color:#334d5c;
    clear:left;
    float:left;
}

.menubutton-leftside {
    width:60px;
    height:20px;
    float:left;
    margin-top:95px;
}

.menubutton-rightside {
    width:60px;
    height:20px;
    float:left;
    margin-top:95px;
    text-align:right;
}

h2 {
    font-family:Tahoma, Geneva, sans-serif;
    font-size:12px;
    font-weight:normal;
    color:#666;
    display:inline;
}

.logo {
    width:170px;
    height:170px;
    float:left;
    margin-top:30px;
}

.largemenubutton {
    width:261px;
    height:259px;
    float:left;
    margin-top:20px;
}

.footer {
    width:100%;
    height: 61px;
    background-color:#334d5c;
    clear:left;
}
position: Absolute;
bottom: 0px;