关于2-11问题

关于2-11问题

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
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
<title></title>
<style type="text/css">
 *{
  padding: 0;
  margin:0;
 }
     .yemian{
      background-color:#00ffff;
      width: 100%;
      height: 1000px;
     }
 .nav{
  height:100px;
  width: 100%;
  background-color: black;
  color:white;
  position: fixed;
  top: 0;
     }
 .nav .logo{
  height:100px;
  float: left;
 
 }
.nav span{
  float: right;
  height: 100px;
        text-align: center;
  line-height: 100px;
  word-spacing: 50px;
   padding-right: 100px;}
    .container{
     width: 70%;
     height: 800px;
     margin:0 auto;
     padding-top: 100px;
     padding-bottom: 100px;
      
    }
    .one{
     width: 35%;
 
        float: left;}
    .one1{
     width: 500px;
     height: 50px;
     margin:10px 0;
     word-spacing: 10px;
    }
    .one1 span{
 
        background-color:#d2691e;
    }
    .two{
      width: 35%;
      height: 700px;
      
      float: left;
      word-spacing: 10px;}
    .two div{
     margin: 15px 0;
     font-weight: 700;
    }
    .footer{
      text-align: center;
      height: 100px;
      width: 100%;
      line-height: 100px;
      word-spacing: 15px;
      background-color: black;
      color:white;
      position: fixed;
      bottom: 0px;
    
    .three{
     width: 25%;
     height: 800px;
     float: left;
     background-color:#00ffff; 
     position: relative;
     border-left: thick solid orange;
    }
    .three .biaodan{
     width: 100px;
     height: 100px;
        position: absolute;
        top:50%;
        left: 50%;
        margin-top: -50px;
        margin-left: -50px;
    }
    .sub{
     background-color: red;
     color: white;
     display: inline-block;
     width:100px;
     height:50px;
     text-align: center;
    }
    .biaodan h1,input{
     margin: 10px auto;
    }
   </style>
</head>
<body>
<div class="yemian">
<div class="nav">
<div class="logo"><img src="http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png"/></div>
<span>课程 职业路径 实战 猿问 手记</span>
</div>
<div class="container">
<div class="one">
<h1>课程推荐</h1>
<div class="one1"><span>职业路径</span> HTML5与CSS3实现动态网页</div>
<div class="one1"><span>职业路径</span> 零基础入门Android语法与界面</div>
<div class="one1"><span>职业路径</span> Ios基础语法与常用控件</div>
<div class="one1"><span>职业路径</span> PHP入门开发</div>
<div class="one1"><span>职业路径</span> Java入门开发</div>
</div>
<div class="two">
<h1>相关课程</h1>
<div>HTML CSS JAVAScript</div>
<div>HTML CSS5 Jquery</div>
<div>移动端基础 移动端app开发</div>
   </div>
   <div class="three">
    <form>
    <div class="biaodan">
    <h1>登录</h1>
    <input type="text" name="name" placeholder="请输入登录邮箱/手机号" /><br/>
    <input type="password" name="pd" placeholder="请输入密码"/><br/>
    <input type="submit" name="sub" class="sub" />
    </div>
    </form>
   </div>
</div>
   <div class="footer">
    <span>网站首页 企业合作 人才招聘 联系我们 常见问题 友情链接</span><br/>
   </div>
</div>
</body>
</html>
请问老师关于这段代码我有两个疑问想请教老师。
1.我应该怎样将one,two里的内容居中?因为我给代码已设置position就会发生重叠现象。
2.请问老师我的页面右侧的three为什么下滑的时候会覆盖fixed的页头部分?


正在回答 回答被采纳积分+1

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

2回答
小丸子爱吃菜 2017-12-12 21:46:52

你想让one和two在水平和垂直方向都居中,是针对谁去居中?因为效果图中没有要求,这两块去居中显示的,所以不是很明白你的需求,可以再详细的说明下。

祝学习愉快!

好帮手慕糖 2017-12-12 19:01:11

你好,1、想将内容如何水平居中,还是垂直居中?这里的布局不需要居中呀,若是觉得有点往上的话,可以设置下margin-top来调整下距离。

2、给导航部分,设置的层级高点即可,例:   z-index: 10;

祝学习愉快~

  • 提问者 hy_wang #1
    老师我想让内容水平垂直都居中
    2017-12-12 19:49:58
问题已解决,确定采纳
还有疑问,暂不采纳

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

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

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

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

帮助反馈 APP下载

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

公众号

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

在线咨询

领取优惠

免费试听

领取大纲

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