1
我在頂部有一個固定標題,內部有6個部分,每個部分都有100%的寬度和高度。我的問題是:如何使用固定導航滾動到錨鏈接
有沒有辦法讓高度的主要區域覆蓋所有6個部分?
如何在滾動到鏈接的部分時突出顯示菜單項?
歡迎任何建議。非常感謝你的幫助。
* {
margin: 0;
padding: 0;
}
#headerArea {
width: 100%;
height: 150px;
background: #000;
position: fixed;
top: 0;
z-index: 2;
}
#gnavArea {
width: 880px;
height: inherit;
float: left;
position: relative;
}
#gnavArea > ul {
list-style: none;
position: absolute;
bottom: 12px;
height: auto;
overflow: hidden;
}
#gnavArea > ul li {
float: left;
padding: 0 5px;
position: relative;
border-bottom: 2px solid;
}
#gnavArea > ul li a {
font-size: 14px;
font-family: Arial;
color: #fff;
text-decoration: none;
}
#mainArea {
position: absolute;
width: 100%;
height: 100%;
}
#section_01, #section_02, #section_03,
#section_04, #section_05, #section_06 {
background-size: 100% 100%;
width: 100%;
height: 100%;
}
#section_01 {
background: grey;
}
#section_02 {
background: yellow;
}
#section_03 {
background: brown;
}
#section_04 {
background: blue;
}
#section_05 {
background: green;
}
#section_06 {
background: red;
}
<div id="headerArea">
<div id="gnavArea">
<ul>
<li><a href="#section_01">section_01</a></li>
<li><a href="#section_02">section_02</a></li>
<li><a href="#section_03">section_03</a></li>
<li><a href="#section_04">section_04</a></li>
<li><a href="#section_05">section_05</a></li>
<li><a href="#section_06">section_06</a></li>
</ul>
</div>
</div>
<div id="mainArea">
<div id="section_01">1</div>
<div id="section_02">2</div>
<div id="section_03">3</div>
<div id="section_04">4</div>
<div id="section_05">5</div>
<div id="section_06">6</div>
</div>