【发布时间】:2015-02-04 17:15:05
【问题描述】:
嗨,当用户向下滚动时,我正在努力将主要内容放在固定标题下方。
当用户向下滚动时,主体不会位于标题下方... 主体只是向上移动到固定的头部......并覆盖它!而不是它从固定标题后面的视图中消失。
我找了很多例子..它们很有帮助,但没有解释为什么主要内容没有消失在固定标题后面...只是向上移动覆盖标题。
我已经尝试添加:
position: relative;
但它使主要内容消失了。
谢谢。
更新的新代码:
index.html
<html ng-app="financeApp">
<head>
<meta charset="utf-8">
<!-- CSS -->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css" />
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- HEADER AND NAVBAR -->
<header>
<div class="wrap">
<!-- logo -->
<!-- <a href="#!"><img class="logo" src="img/history_00.png" /></a>
<h7>Building lasting relationships<h7>-->
<ng-controller = "demoCtrl">
<ul class="nav nav-pills pull-left">
<li ng-class="{active: isState('home') }">
<a ui-sref="home">HOME</a>
</li>
<li ng-class="{active: isState('form') }">
<a ui-sref="form">ABOUT US</a>
<li ng-class="{active: isState('form') }">
<a href="#candidates">CANDIDATES</a>
</li>
<li ng-class="{active: isState('jobs') }">
<a ui-sref="jobs">JOBS</a>
</li>
<li ng-class="{active: isState('joinus') }">
<a ui-sref="joinus">JOIN US</a>
</li>
<li ng-class="{active: isState('contact') }">
<a ui-sref="contact">CONTACT US</a>
</li>
</ul>
<h3 class="text-muted"> </h3>
<br>
</div>
</header>
<!--<div class="full-background">-->
<div ui-view class="main"></div>
<!--</div>
</div>-->
<!-- Loading the Footer -->
<div id="footer" ng-include="'partials/footer.html'"></div>
</body>
</html>
<!-- App JS -->
这更多的是 style.css:
header {
height:10px;
position: fixed;
width:100%;
height:75px;
margin-top:30px;
margin-bottom: 50px;
}
header .nav {
/* float:center;*/
margin: 10px auto 0;
/*position: fixed;*/
/*z-index:1;*/
background: #0783A9;
}
.nav {
background-color:#0783A9 ;
color: white;
/* float:center;*/
}
.nav>li>a {
color: white;
}
.nav-pills>li>a:hover {
color: white;
background: transparent;
cursor: pointer;
background: #cecece;
}
【问题讨论】:
-
可能只是定位/z-index 问题。您能否向我们提供您的 HTML 的精简版本和相应的样式?另外,这和角度有什么关系?