有点难,也很多人不会,但我硬啃下来了!不知道我花5个小时啃下来值不值得~老师看下我实现得怎么样~

有点难,也很多人不会,但我硬啃下来了!不知道我花5个小时啃下来值不值得~老师看下我实现得怎么样~

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
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>我的方法</title>
  <style type="text/css">
    *{margin:0;padding:0;}
    /*头部*/
    .head{
        font-size:16px;
        font-family:"微软雅黑";
        background:rgb(0,0,0);
        width:100%;
        height:70px;
        position:fixed;
    }
    .head img{
        width: 210px;
        height: 70px;
    }
    .nav{
        display:inline-block;
        float:right;
        position:absolute;
        top:50%;
        right:0px;
        margin-top:-12px;
    }/*为何不能用line-height: 100px;?只能像这样声明?*/
    .nav a{
        text-decoration:none;
        color:#fff;
        padding:24px;
    }
 
    /*主体内容*/
    .body{
        width: 100%;
        min-height: 600px;
        background: rgb(150,200,200);
        padding-top: 100px;
    }
    .bodybox{
        width: 70%;
        height: 410px;
        margin:0 15%;
        position: absolute;
    }
 
    /*主体内容左边*/
    .left{
        width: 55%;
        height: 410px;
        float: left;
        position: relative;
    }
    .lefttable{
        margin-top: 36px;
    }
 
    tr{ display: block;
        padding: 8px;
    }
    th{
        font-size: 24px;
    }
    .tablecell1{
        color: rgb(0,0,0);
        background-color: rgb(200,100,100);
        width: 70px;
        height:24px;
        font-size: 16px;
        margin-right: 16px;
         
    }
    .tablecell2{
        padding-left: 16px;
    }
 
    /*主体内容右边*/
    .right{
        width: 45%;
        height: 410px;
        float: left;
        position: relative;
    }
    .rightcon{
        width: 250px;
        margin-top: 36px;
 
    }
    .rightcon .p1{
        font-size: 24px;
        padding: 10px;
    }
    .rightcon .p4 a{
        text-decoration:none;/*对行内元素a标签设置背景色时得加这个*/
        display: inline-block;/*对行内元素a标签设置背景色时得加这个*/
        color:rgb(0,0,0);
        font-size: 16px;
        padding: 10px;
    }
 
    /*底部*/
    .foot{
        background: rgb(0,0,0);
        width: 100%;
        height: 70px;
        position: fixed;
        bottom: 0;
        line-height: 70px;
        text-align: center;/*为何用margin: 0 auto;没用*/
    }
    .foot a{
        display: inline-block;/*对行内元素a标签设置背景色时得加这个*/
        text-decoration:none;/*对行内元素a标签设置背景色时得加这个*/
        color: #fff;
        font-size: 16px;
        padding: 0 20px;
    }
  </style>
</head>
<body>
  <!-- 此处写代码 -->
<div class="head">
    <img src="http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png">
     
    <div class="nav">
        <a href="#">课程</a>
        <a href="#">职业路径</a>
        <a href="#">实战</a>
        <a href="#">猿问</a>
        <a href="#">手记</a>
    </div>
</div>  
<div class="body">
    <div class="bodybox">
        <div class="left">
          <table class="lefttable">
            <tr>
              <th>课程推荐</th>
            </tr>
            <tr>
              <td class="tablecell1">职业路径</td><td class="tablecell2">HTML5与CSS3实现动态网页</td>
            </tr>
            <tr>
              <td class="tablecell1">职业路径</td><td class="tablecell2">零基础入门Android语法与界面</td>
            </tr>
            <tr>
              <td class="tablecell1">职业路径</td><td class="tablecell2">iOS基础语法与常用控件</td>
            </tr>
            <tr>
              <td class="tablecell1">职业路径</td><td class="tablecell2">PHP入门开发</td>
            </tr>
            <tr>
              <td class="tablecell1">职业路径</td><td class="tablecell2">JAVA入门开发</td>
            </tr>
          </table>
        </div>
        <div class="right">
          <div class="rightcon">
            <p class="p1">相关课程</p>
            <p class="p4">
                <a href="#">HTML</a>
                <a href="#">CSS</a>
                <a href="#">JavaScript</a>
                <a href="#">HTML5</a>
                <a href="#">CSS3</a>
                <a href="#">Jquery</a>
                <a href="#">移动端基础</a>
                <a href="#">移动端APP开发</a>
            </p>
          </div>
        </div>
    </div>
</div>
<div class="foot">
    <a href="#">网站首页</a>
    <a href="#">企业合作</a>
    <a href="#">人才招聘</a>
    <a href="#">联系我们</a>
    <a href="#">常见问题</a>
    <a href="#">友情链接</a>
</div>
</body>
</html>


正在回答

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

2回答

同学,你好。整体实现的还是很不错的,但是还有一点不太完美的地方,中间区域的高度是不够的,致使中间区域与页脚之间出现了空白,如图:

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

建议可以同学可以给中间区域设置固定高度800px,如图:

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

很为你高兴,坚持自己做出来习题,只要坚持就一定能完成,这个是毋庸置疑的,希望后面的课程你也能继续保持这样的毅力,这一次你用了5个小时,下一个问题可能4个小时,会越来越快。

祝学习愉快!

  • Sherlock_bourne 提问者 #1
    嗯嗯,好的,老师。老师,如何实现网页背景高度的自适应?我设600px的高度,其实在我电脑上都够了,还有多的,但是像老师电脑分辨率就比我好多了,就会出现显示不全的情况。
    2019-03-04 17:24:34
bbbboom 2019-02-26 18:47:11

效果实现的不错,

问题已解决,确定采纳
还有疑问,暂不采纳

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

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

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

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

帮助反馈 APP下载

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

公众号

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

在线咨询

领取优惠

免费试听

领取大纲

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