这里的右侧导航条在第一屏里随页面滚动,在第二屏就消失了, 请指教~

这里的右侧导航条在第一屏里随页面滚动,在第二屏就消失了, 请指教~

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>分屏网页</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<!--头部-->
<div class="box">
<header class="header">
<div class="header_wrap">
<div class="header_logo">H5实战页面</div>
<nav class="header_nav">
<a href="#" class="header_nav-item header_nav-item_status_active">实战课程</a>
<a href="#" class="header_nav-item">商业案例</a>
<a href="#" class="header_nav-item">课程体系</a>
<a href="#" class="header_nav-item">集成环境</a>
<a href="#" class="header_nav-item">云端学习</a>
<a href="#" class=" header_nav-item_custom_button">即刻学习</a>
</nav>
    </div>
</header>
<!--标签-->
<div class="outline">
           <a href="#" class="outline-item">实</a>
           <a href="#" class="outline-item">商</a>
           <a href="#" class="outline-item">课</a>
           <a href="#" class="outline-item">环</a>
           <a href="#" class="outline-item">云</a>
        </div>
<!--第一屏-->
<div class="screen-1">
<div class="screen-1_heading">
<h2>实战课程重磅上线</h2>
<p>一键云学习,还在等待什么?</p>
</div>
</div>
<!--第二屏-->
<div class="screen-2">
<div class="screen-2_wrap">
<h2 class="screen-2_heading">每门课都是真实商业案例</h2>
<h6 class="screen-2_subheading">真实案例,真实场景,在实战中实践、操作、调试<br>大牛带你体验BAT真实开发流程,所有开发过程一一为你呈现</h6>
<div class="screen-2_photo">
  <div class="screen-2_photo-1"></div>
  <div class="screen-2_photo-2"></div>
</div>
</div>
 
</div>
</div>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
*{margin0;
padding0;
}
/*头部导航条*/
.box{
    positionrelative;
}
.header{
    width100%;
     background:linear-gradient(blacktransparent);
     position:fixed
     top:0;
}
.header_wrap{
    width1200px;
    height80px;
    margin0 auto;
    positionrelative;
}
.header_logo{
    width:200px;
    height39px
    line-height39px
    font-size20px;
    colorwhite;
    text-indent50px;
    backgroundurl('../img/logo.png')left center no-repeat;
    background-size39px 39px;
    positionabsolute;
    top50%;
    margin-top-20px;
    left20px;
}
.header_logo:hover{
    color#f01044;
    cursorpointer;
}
.header_nav{
    positionabsolute;
    right20px;
    height39px;
    top50%;
    margin-top-20px;
}
.header_nav-item{
    colorwhite;
    font-size14px;
    displayblock;
    height39px;
    line-height39px;
    floatleft;
    positionrelative;
    width59px;
    text-aligncenter;
    margin-left44px;
    text-decoration:none
}
.header_nav-item:hover{
    height45px;
    cursorpointer;
    border-bottom2px solid #f00;
}
.header_nav-item_status_active{
    colorred;
    height45px;
    border-bottom2px solid #f00;
}
.header_nav-item_custom_button{
 background:#f01400;
 color#fbf0ff;
 text-aligncenter;
 width99px;
 margin-left40px;
 padding0;
 border-radius: 3px;
 colorblack;
    font-size14px;
    displayblock;
    height39px;
    line-height39px;
    floatleft;
    positionrelative;
    text-decoration:none
}
.header_nav-item_custom_button:hover{
    background:#ff5511;
}
/*标签*/
.outline{
    width40px;
    height150px;
    background#fff;
    position:fixed;
    right0;
    bottom200px;
}
.outline-item{
    margin:6px 0;
    color#000;
    text-decorationnone;
    text-aligncenter;
    displayblock;
}
/*第一屏*/
.screen-1{
    height640px;
    width100%;
    background:url(../img/sc1.jpg) center center no-repeat;  
    background-size: cover;
}
.screen-1_heading{
    padding0;
    margin:0;
    width100%;
    height640px;
    displayblock;
    text-aligncenter;
    positionabsolute;
    top320px;
    margin-top-12px;
    font-size24px;
    colorwhite;
}
.screen-1_heading p{
    font-size16px;
    margin-top29px;
}
/*第二屏*/
.screen-2{
 background-color#f3f5f7;
 positionrelative;
}
.screen-2_wrap{
 width1200px;
 height640px;
}
.screen-2_heading{
    font-weightnormal;
    margin:0;
    padding:0;
    font-size44px;
    line-height44px;
    color#000000;
    padding-top90px;
    text-aligncenter;
}
.screen-2_heading::after{
    content:" ";
    displayblock;
    height2px;
    width:52px;
    margin-top36px;
    background-color#ff0000;
    positionabsolute;
    left50%;
    margin-left-26px;
}
.screen-2_subheading{
    font-weightnormal;
    margin:0;
    padding:0;
    font-size13px;
    line-height26px;
    color#2c3137;
    padding-top50px;
    text-aligncenter;
}
.screen-2_photo{
    width740px;
    height362px;
    backgroundurl(../img/sc2.png) no-repeat;
    background-position: cover;
    positionabsolute;
    bottom0;
    left50%;
    margin-left-370px;
    z-index0;
}
.screen-2_photo-1{
    width277px;
    height383px;
    backgroundurl(../img/sc2-1.png) no-repeat;
    positionabsolute;
    bottom0;
    left50%;
    margin-left:-134px;
    z-index2;
}
.screen-2_photo-2{
    width266px;
    height205px;
    backgroundurl(../img/sc2-2.png) no-repeat;
    positionabsolute;
    top56px;
    left50%;
    z-index1;
}
 
/*第三屏*/
.screen-3{
 width100%;
 height640px;
 background-color#2b333b;
}
.screen-3_bg


正在回答

登陆购买课程后可参与讨论,去登陆

2回答

同学你好,原因是标题下面红色的线是绝对定位,因为.screen-2设置了定位,所以是根据.screen-2来进行定位的,.screen-2的宽度为100%,所以会出现这种情况。

建议:给父级设置相对定位。代码参考: 
http://img1.sycdn.imooc.com//climg/5dccaf6509d4784103600377.jpg

如果还有其他疑问,建议在问答区重新提问,便于同学后期查找总结

如果我的回答帮到了你,欢迎采纳,祝学习愉快~

好帮手慕言 2019-11-13 11:13:57

同学你好,出现这种情况的原因是:第二屏设置了定位,并且在右侧导航的后面,所以层级会高些,在滚动时发生了覆盖。

如图:

http://img1.sycdn.imooc.com//climg/5dcb74a3092aad4103250124.jpg

建议:

方法1:去掉给第二屏设置的定位。

代码参考:

http://img1.sycdn.imooc.com//climg/5dcb743609d63bea04520136.jpg

方法二:提升右侧导航条的层级。

代码参考:

http://img1.sycdn.imooc.com//climg/5dcb74ce0968170503410314.jpg

如果还有其他疑问,建议在问答区重新提问,便于同学后期查找总结

如果我的回答帮到了你,欢迎采纳,祝学习愉快~

  • 提问者 Cora_123 #1
    还有一个问题就是第二屏大小标题之间这里的红线位置有点怪异,当我调出浏览器的调试工具的时候,位置就变化了,请问是什么差错呢?
    2019-11-13 20:33:28
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师
插入代码