gpt4 book ai didi

html - 我的页脚 DIV 不会位于页面底部

转载 作者:行者123 更新时间:2023-11-28 10:19:27 26 4
gpt4 key购买 nike

我有一个页脚 div,它只是一种纯色,我想将它放在容器 DIV 外部的底部,称为“mainhome”。我希望它能拉伸(stretch)整个网站。它一直位于我的横幅顶部 - 我现在迷失在代码中,所以也许我只是错过了一些小东西?

提前致谢

我的 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>

我的 CSS

@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;
}

最佳答案

看起来 .nameimage 不需要绝对定位,但这取决于你想让它做什么。粗略示例:http://codepen.io/anon/pen/oAbJy .

关于html - 我的页脚 DIV 不会位于页面底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24100438/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com