我有一个我正在处理的网页。目前,页眉和页脚停留在页面上。滚动的唯一部分是身体。滚动条仅显示在页面的“正文”部分中。我试图弄清楚如何更改它,以便整个页面滚动而不是只有一个部分,其余部分被锁定到位。我试过删除" position:fixed"从我的css,但除了完全从屏幕上删除页脚之外,没有任何改变。
这是我的CSS
/********************************
* Shared Layout *
********************************/
#header {
padding: 5px 0px 0px 20px;
top: 0;
position: fixed;
height: 170px;
background-color: #000;
}
.logo-image {
float: left;
margin: 7px 20px 0px 0px;
}
.clear-fix:after {
content: ".";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
body {
background-color:#efeeef;
color: #333;
font-size: .85em;
font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
overflow: hidden;
}
#body {
top: 170px; bottom: 130px;
background-color: #efeeef;
clear: both;
padding-bottom: 0px;
overflow-y: auto;
position: absolute;
}
.content-wrapper {
margin: 0 auto;
max-width: 1125px;
}
#footer {
position: fixed;
bottom: 0;
clear: both;
background-color: #000;
font-size: .8em;
height: 130px;
color: #FFF;
}
#footer, #body, #header {
left: 0; right: 0;
}
#follow-icons {
padding-top: 13px;
float: right;
}
#logo-table {
clear: left;
margin: 0 auto;
}
#logo-table td{
padding: 0px 10px;
}
.float-left {
float: left;
}
.float-right {
float: right;
}
这是HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Atlas Web Pages</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
<script src="@Url.Content("~/Scripts/knockout-2.1.0.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.7.1.js")" type="text/javascript"></script>
</head>
<body style="-webkit-box-shadow:3px 2px 15px #3D3D3D">
<header id="header">
<div class="web-header">
<div class="logo-image">
<img style="vertical-align:top" src="~/Images/WebPageLogo.png" height="85" width="820" alt="Atlas Logo" />
<br />
<div style="color:#FFF">*A southpaw's approach to bowling*</div>
</div>
<div class="float-right">
<nav>
<ul id="menu">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("The Team", "About", "About")</li>
<li>@Html.ActionLink("Current Line-Up", "CurrentList", "Current")</li>
<li>@Html.ActionLink("Retired Equipment", "RetiredList", "Retired")</li>
<li>@Html.ActionLink("Tournaments", "TourneyInfo", "Tournament")</li>
<li>@Html.ActionLink("Bowling Videos", "Videos", "Video")</li>
<li>@Html.ActionLink("Sponsors", "Sponsors", "Sponsor")</li>
</ul>
</nav>
</div>
</div>
</header>
<div id="body">
@RenderSection("featured", required: false)
<section class="content-wrapper main-content clear-fix">
@RenderBody()
</section>
</div>
<footer>
<div id="footer">
<div class="content-wrapper">
<div class="float-left">
<p>© @DateTime.Now.Year: Southpaw Web Solutions™ - Email: jmilam90@gmail.com</p>
</div>
<div id="follow-icons">
<a href ="www.facebook.com/jmilam90"><img src="~/Images/FBIcon.png" alt="Follow on Facebook" height="40" width="40" /></a>
<a href ="www.twitter.com/jmilam900"><img src="~/Images/TwitIcon.png" alt="Follow on twitter" height="40" width="40" /></a>
<a href ="https://www.youtube.com/channel/UCCSdkWipauQ1mhzEPAJfOnA"><img src="~/Images/YTIcon.png" alt="Subscribe on Youtube" height="40" width="40" /></a>
</div>
</div>
<table id="logo-table">
<tr>
<td>
<img src="~/Images/Logos/MBW.png" width="99" height="60" alt="McCorveys Bowling World Logo" />
</td>
<td>
<img src="~/Images/Logos/EboniteLogo.png" width="93" height="60" alt="Ebonite Logo" />
</td>
<td>
<img src="~/Images/Logos/TrackLogo.png" width="152" height="60" alt="Track Bowling Logo" />
</td>
<td>
<img src="~/Images/Logos/HammerLogo.png" width="100" height="60" alt="Hammer Bowling Logo" />
</td>
<td>
<img src="~/Images/Logos/ColumbiaLogo.png" width="123" height="60" alt="Columbia 300 Logo" />
</td>
<td>
<img src="~/Images/Logos/PBALogo.png" width="60" height="60" alt="PBA Logo" />
</td>
</tr>
</table>
</div>
</footer>
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
有谁可以告诉我需要删除/更改哪些内容才能让整个页面滚动?
答案 0 :(得分:1)
看不到HTML,您需要:
删除position: fixed;
和#header
以及现在多余的#footer
和top
上的bottom
。
此问题也是由top: 170px; bottom: 130px;
上的position: absolute
和#body
造成的。完全删除#body
。
删除现在多余的:
#footer, #body, #header {
left: 0; right: 0;
}
你留下:
#header {
height:170px;
background-color:#000
}
.logo-image {
float:left;
margin:7px 20px 0 0
}
.clear-fix:after {
content:".";
clear:both;
display:block;
height:0;
visibility:hidden
}
body {
background-color:#efeeef;
color:#333;
font-size:.85em;
font-family:"Segoe UI",Verdana,Helvetica,Sans-Serif;
margin:0;
padding:0;
overflow:hidden
}
.content-wrapper {
margin:0 auto;
max-width:1125px
}
#footer {
clear:both;
background-color:#000;
font-size:.8em;
height:130px;
color:#FFF
}
#follow-icons {
padding-top:13px;
float:right
}
#logo-table {
clear:left;
margin:0 auto
}
#logo-table td {
padding:0 10px
}
.float-left {
float:left
}
.float-right {
float:right
}