如何获得具有固定边栏和内容分区的固定标头?
到目前为止我做了什么:
body {
margin:0;
}
.header {
width: 100%;
background: #303030;
background-repeat: repeat;
background-size: 38px 133px;
height: 40px;
background-position: 0px 39px;
box-shadow: 0px 1px 5px;
position: fixed;
z-index: 1000;
}
.sidebar {
z-index: 100;
position: fixed;
height: 100%;
width: 200px;
background: #303030;
}
.content {
padding: 10px;
width: 810px;
margin: auto;
min-height: 30px;
box-shadow: 0px 1px 5px;
background-color: rgba(255,255,255,0.7);
margin-left: 20%;
}

<div class="header"></div>
<div class="sidebar"></div>
<div class="content"></div>
&#13;
但目前它并不稳定,有点奇怪。例如,Content Div浮动在我的侧边栏下面。
有人知道更好,更有效的解决方法吗?
答案 0 :(得分:1)
CSS中有一些小的变化,如:
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *HeaderView = [[UIView alloc] init];
HeaderView.backgroundColor = [UIColor clearColor];
header = [[EscortHederView alloc] initWithFrame:CGRectMake(HeaderView.frame.origin.x, HeaderView.frame.origin.y, HeaderView.frame.size.width, HeaderView.frame.size.height)];
[HeaderView addSubview:header];
header.coridersTextfield.delegate = self;
header.coridersTextfield.userInteractionEnabled = YES;
return HeaderView;
}
这样就可以了。如果没有,请发表评论。
答案 1 :(得分:1)
我认为它会对你有所帮助,因为你理解我为内容div添加了红色边框。只有我改变了CSS。
.content {
position: fixed;
top: 41px;
bottom: 0px;
left: 200px;
border: 2px solid red;
right: 0px;
}
body {
margin:0;
}
.header {
width: 100%;
background: #303030;
background-repeat: repeat;
background-size: 38px 133px;
height: 40px;
background-position: 0px 39px;
box-shadow: 0px 1px 5px;
position: fixed;
z-index: 1000;
}
.sidebar {
z-index: 100;
position: fixed;
height: 100%;
width: 200px;
background: #303030;
}
.content {
position: fixed;
top: 41px;
bottom: 0px;
left: 200px;
border: 2px solid red;
right: 0px;
}
&#13;
<div class="header"></div>
<div class="sidebar"></div>
<div class="content"></div>
&#13;