一旦我的网站上出现垂直滚动条,它的下半部分似乎就丢失了。您可以看到实际网站HERE(转到"进一步阅读"标签)。
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<title>History of Le Mans</title>
<link rel="stylesheet" type="text/css" href="CSS/common.css">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="JS/common.js"></script>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
</head>
<body>
<nav>
<ul id="tabs">
<li><a href="#" id="tab1" name="#tabContent1" class="activeTab">Home</a></li>
<li><a href="#" id="tab2" name="#tabContent2">History</a></li>
<li><a href="#" id="tab3" name="#tabContent3">The Circuit</a></li>
<li><a href="#" id="tab4" name="#tabContent4">Gallery</a></li>
<li><a href="#" id="tab5" name="#tabContent5">Further Reading</a></li>
</ul>
</nav>
<div id="content">
<div id="tabContent1"></div>
<div id="tabContent2">
<div id="accordion">
<div class="group">
<h3>Section 1</h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
</div>
<div class="group">
<h3>Section 2</h3>
<div>
<p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>
</div>
</div>
<div class="group">
<h3>Section 3</h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
</div>
<div class="group">
<h3>Section 4</h3>
<div>
<p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
</div>
</div>
</div>
<div id="tabContent3"></div>
<div id="tabContent4"></div>
<div id="tabContent5"></div>
</div>
</body>
</html>
CSS:
body {
background-color: #EEEEEE;
font-family: Arial,Helvetica;
font-size: small;
height: 100%;
margin: 100px auto 0;
width: 100%;
}
#tabs {
list-style: none outside none;
margin: 0;
overflow: auto;
padding: 0;
position: relative;
top: -98px;
width: 100%;
}
#tabs li {
float: left;
margin: 0 -15px 0 0;
}
#tabs a {
border-bottom: 30px solid #3D3D3D;
border-right: 30px solid transparent;
color: #FFFFFF;
float: left;
height: 0;
line-height: 30px;
opacity: 0.3;
padding: 0 40px;
position: relative;
text-decoration: none;
text-transform: uppercase;
}
.hover {
border-bottom-color: #2AC7E1 !important;
opacity: 1 !important;
}
#content {
background: none repeat scroll 0 0 #FFFFFF;
border-top: 2px solid #3D3D3D;
height: 100%;
padding: 2em 0 0 2em;
position: absolute;
top: 30px;
width: 98%;
}
.activeTab {
border-bottom-color: #3D3D3D !important;
opacity: 1 !important;
}
.title {
position: relative;
font-weight: bold;
font-size: 1.25em;
float: right;
top: -450px;
right: 300px;
}
.bookPara {
position: relative;
left: 400px;
top: -400px;
}
#accordion {
position: relative;
width: 350px;
float: right;
}
我该如何解决这个问题?
答案 0 :(得分:0)
我很确定您的问题涉及height:100%
,position: fixed
和top: 30px
的组合(在内容ID上)。
你的高度填满窗户,固定在位,然后向下推30px。
我真的不明白为什么你按照你的方式构建布局,但你需要删除上述约束之一,以防止页面超出窗口底部。