gpt4 book ai didi

css - 页面太长(使用粘性页脚)

转载 作者:行者123 更新时间:2023-11-28 18:54:07 25 4
gpt4 key购买 nike

嗨~我正在在线制作艺术作品集,但遇到了一个问题。我使用了粘性页脚 ryanfaitdotcom/sticky-footer/现在我的页面似乎长得不必要。任何建议将不胜感激!

代码如下:

因为不对,所以删了。正确的代码可以在底部找到

或在这里:

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>
<link rel="stylesheet" href="css/layout.css"/>
<link rel="stylesheet" href="css/style.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>





</head>

<body>
<div class="wrapper">
<div id="page-wrap" class="group">
<div id="main-content">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut </p>
</div> <!-- End main-content -->
</div> <!-- End page-wrap -->
<div class="push"></div>
</div> <!-- End wrapper -->
<div class="footer">
<img src="Images/organicspahouston_logo.png" width="400" height="238" />
<div class="bottom">
<p>Copyright (c) 2008</p>
</div>
</div>
</body>

使用 style.css

* {margin: 0;padding: 0;}
html { height: 100%; background:#B5A9A0 url(../Images/osh_pic_bg1.png) no-repeat; background-size: 100%}
body { height: 100%; font: RomulC; font-size: 12px; color:#A39E95; text-align: center }

article, aside, figure, footer, header, nav, section { display: block; }

.group:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
.group { display: inline-block; clear: both; }
/* start commented backslash hack \*/ * html .group { height: 1%; } .group { display: block; } /* close commented backslash hack */

.wrapper {
position: relative;
width: 800px;
margin: 0 auto -258px;
}

#page-wrap { width:800px; -moz-border-radius: 15px;
border-radius: 15px; margin: 175px auto; background:#000; position:relative;}

#main-content { float:right; width: 640px; margin: 10px 10px 10px 0px; -moz-border- radius: 15px;
border-radius: 15px; background: #2D261C; position: relative; padding: 10px 0px 0px 0px; }

.footer {
position: relative;
width: 100%;
margin: 0 auto 0;
padding: 0;
text-align:center;
height: 258px;
overflow:hidden;
}

.footer img {
position: relative;
width: 400px;
margin: 0 auto;
}
.bottom {
position: relative;
width: 100%;
height: 20px;
margin: 0 auto 0;
padding: 0;
text-align:center;
background-color: #000000;
}

.bottom a {
color: #fff;
text-decoration: underline;
border: 0;
}

.bottom p {
position: absolute;
left: 0;
bottom: 4px;
width: 100%;
padding: 0;
color: #fff;
font: 0.8em arial,sans-serif;
}


</html>

和来自粘性页脚的 layout.css

* {
margin: 0;
}
html, body {
height: 800px;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -258px; /* the bottom margin is the negative value of the footer's height */
}
.footer {
height: 258px; /* .push must be the same height as .footer */
}

.push {
height: 258px; /* .push must be the same height as .footer */
}

/*

@Samich 为我提供了以下解决方案(另外还极大地帮助我清理了东西)。我正在添加边距,但我必须将它添加到两侧,所以它来自:

#page-wrap { width:800px; -moz-border-radius: 15px;
border-radius: 15px; margin: 175px auto; background:#000; position:relative;}

#page-wrap { width:800px; -moz-border-radius: 15px;
border-radius: 15px; margin: 175px auto Opx; background:#000; position:relative;}

http://jsfiddle.net/kagawa_leah/c2N24/11/

0 有什么不同。

最佳答案

您需要将页脚的 height 和 wrapper 的 margin-bottom 设置为相同的值。在你的例子中是 4em.

http://jsfiddle.net/WqNEj/3/

附言 http://jsfiddle.net/WqNEj/8/

我在页脚中设置了 overflow:hidden,因为它的高度为 260px,比页脚高度大。

关于css - 页面太长(使用粘性页脚),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8485493/

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