Fork me on GitHub

A simple demo _Web page layout

javaweb之网站布局demo

demo课程来源:慕课网javaweb课程
分析:实现了静态网页的展示效果。
效果图:
1
2
3
4
add

绘制概述:

  1. 将备用图片新建image文件夹,与html和css文件置于同一目录下
    5
  2. 将整个网页6个区域,找6个盒子对应
    • 标题及导航区
    • 横幅栏
    • about区
    • picture-word区
    • gallery区
    • footer区
  3. 按照不同区特点,设计css样式,主要涉及知识点:盒子模型、定位、浮动、遮罩、hover等

步骤详解

一、标题及导航区

6

  • html指向外部css文件
  • header由logo及nav两部分构成
  • nav细分出六个小导航
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!--html文件-->
<head>
<meta charset="utf-8">
<title>Career Builder</title>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<div class="header">
<div class="logo"><img src="images/logo.png"></div>
<div class="nav">
<div class="nav-li">HOME</div>
<div class="nav-li">ABOUT</div>
<div class="nav-li">GALLERY</div>
<div class="nav-li">FACULTY</div>
<div class="nav-li">EVENTS</div>
<div class="nav-li">CONTACT</div>
</div>
</div>
  • 消除浏览器默认边距,设置微软雅黑字体
  • logo设置左浮动
  • nav设置右浮动
  • nav-li设置左浮动,同时调整间距,垂直居中对齐
  • nav-li设置hover效果,悬浮时nav-li块出现黑色背景效果,鼠标变为“小手”效果
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
<!--css文件-->
*{
padding:0;
margin: 0;
font-family: "Microsoft YaHei UI";
}

/*标题及导航*/
.header {
width: 100%;
height: 48px;
background-color: #07cbc9;
}
.header .logo {
width:260px;
height:48px;
float: left;
margin-left: 90px;
}
.header .nav{
height:48px;
float: right;
color: #ffffff;
margin-right:90px;
}
.header .nav .nav-li{
background-color:#07cbc9;
float: left;
font-size: 12px;
line-height: 48px;
margin-left: 10px;
margin-right: 5px;
padding-left: 5px;
padding-right: 5px;
}
.header .nav .nav-li:hover{
background-color: #333;
cursor: pointer;
}

二、横幅栏

7

  • banner盒子,限定banner区尺寸及绝对定位
  • 内部设计三层盒子,从底往上为:
    1. bannerP,放置图片
    2. toplayer,黑色方形图片,为实现遮罩效果
    3. toplayer-top,banner中央的表格
  • toplayer-top上,分成3类Msg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!--html-->
<!-- 横幅栏,图片、遮挡、表格 -->
<div class="banner">
<div class="bannerP"><img src="images/banner3.jpg"></div>
<div class="toplayer"></div>
<div class="toplayer-top">
<ul class="personMsg">
<li><input type="text" class="Msg1" value=" your Name"></li>
<li><input type="text" class="Msg1" value=" your Phone"></li>
<li><input type="text" class="Msg1" value=" your Email"></li>
<li><input type="text" class="Msg2" value=" Write Your Comment Here"></li>
<button class="Msg3" type="summit">SEND MESSAGE</button>
</ul>
</div>
</div>
  • bannerP与banner区尺寸重合
  • toplayer与banner区尺寸重合,黑色背景,透光0.5
  • toplayer-top表格在banner居中对齐
  • 三个Msg实现透明背景,乳白色线条
  • 按钮居中对齐
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
<!--css-->
/*横幅层*/
.banner {
width: 100%;
position: absolute;
top:48px;
left: 0;
}
.banner .bannerP img{
width: 100%;

}
.banner .toplayer{
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
opacity: 0.5;
}
.banner .toplayer-top{
width: 30%;
position: absolute;
top:20%;
left: 35%;
/*margin-left: -25%;
margin-top: -25%;*/
z-index: 2;
}
.banner .personMsg{
padding-top: 10px;
line-height: normal;
list-style: none;
}
.banner .personMsg .Msg1,.Msg2,.Msg3{
background-color: transparent;
width: 100%;
font-size: 12px;
color: #D3D3D3;
border: 2px solid grey;
margin: 10px;
}
.banner .personMsg .Msg1{
height: 30px;
}
.banner .personMsg .Msg2{
height: 100px;
}
.banner .personMsg .Msg3{
width: 40%;
height: 30px;
margin-left: 30%;
text-align: center;
cursor: pointer;
}

三、about区

8

  • about盒子,限制该区范围
  • 分为about-title、title-line、about-desc、about-content四大块
  • 前三块样式简单,但about-content复杂,再细分为content-explore、content-img、content-count三块
  • content-explore分为explore-title、explore-block两块
  • content-count分为count1和count2两块
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
<!--html-->
<div class="about">
<div class="about-title">ABOUT</div>
<div class="title-line"></div>
<div class="about-desc">Lorem Ipsum is simply dummy text of the printing and typesetting <br>industry.Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s.</div>
<div class="about-content">
<div class="content-explore">
<div class="explore-title">A WORD <br>ABOUT US</div>
<div class="explore-block">
<div class="block-word">Praesent dignissim viverra est,sed<br>bibendum ligula congue non.Sed ac nisl<br>
et felis gravida commodo? Suspendisse <br>eget ullamcorper ipsum.Suspendisse<br>diam amet.</div>
<button class="block-button">EXPLORE</button>
</div>
</div>
<div class="content-img">
<img src="images/bb3.jpg">
</div>
<div class="content-count">
<div class="count1">
<div class="num">70000</div>
<div class="title-line"></div>
<div class="name">Students</div>
</div>
<div class="count2">
<div class="num">600</div>
<div class="title-line"></div>
<div class="name">Faculty</div>
</div>
</div>
</div>
</div>
  • about-title绝对定位,title-line相对于about-title定位,可使title-line代码实现复用
  • about-content中,content-img是中间块并且绝对定位,两边块相对于中间块定位,左边块的z-index设置为2,设置对应left偏移,实现块与块之间少量面积重叠
  • 左块content-explore调整背景颜色rgba(255, 255, 255, 0.4),形成毛玻璃效果
  • content-count的上下两块,可以实现样式复用
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
<!--css-->

/*about区*/
.about{
width: 70%;
/* background-color: orange;*/
position: absolute;
left: 15%;
/* top:730px;*/
top:90%;
}
.about .about-title{
text-align: center;
font-size: 25px;
font-weight: bolder;
margin-top:20px;
margin-bottom: 5px;
}
.title-line{
width:20px;
line-height: 1px;

border-bottom-style: solid ;
border-color: #07cbc9;
position: relative;
left: 50%;
margin-left: -10px;
}
.about .about-desc{
text-align: center;
width:100%;
font-size: 10px;
color: grey;
margin-top: 13px;
margin-bottom: 13px;
}
.about .about-content{
width: 100%;
margin-bottom: 200px;
}
.about .about-content .content-explore{
width: 28%;
float: left;
z-index: 2;
margin-left: 10%;
position: relative;
top:0;
left: 2%;
}
.about .about-content .content-explore .explore-title{
text-align: left;
margin-left: 15px;
}
.about .about-content .content-explore .explore-block{
text-align: left;
font-size: 12px;
position: relative;
top:0;
left: 0;
border: 1px solid #D3D3D3;
margin-top: 5px;
padding: 10px;
/*background-color: #ffffff;
opacity: 0.5;*/
background-color: rgba(255, 255, 255, 0.4);
}
.about .about-content .content-explore .explore-block .block-word{
/*margin:5px;*/
margin-left: 5px;
margin-top: 5px;

}
.about .about-content .content-explore .block-button{
width: 60px;
height:30px;
margin:5px;
background-color: #333;
color: #ffffff;
cursor: pointer;
}
.about .about-content .content-img img{
width: 40%;
float: left;
position: absolute;
top:120px;
left:280px;
}
.about .about-content .content-count{
width: 20%;
float: left;
text-align: center;
position: relative;
top:0;
left: 35%;
}
.about .about-content .content-count .count1{
width: 120px;
height: 80px;
border: 1px solid #07cbc9;
margin:10px;
}
.num{
margin:10px auto;
}
.name{
margin: 10px auto;
font-size: 14px;
}
.about .about-content .content-count .count2{
width: 120px;
height: 80px;
border: 1px solid #07cbc9;
margin:10px;
}

四、picture-word区

9

  • picture-word盒子,限定该区范围
  • 分为layer1..8,图文间隔排布
  • 文字区细分四部分(layerword_1、layerword_2、layerword_3、layerword_button),各文字区样式代码可以复用
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
<!--html-->
<!-- picture-word区 -->
<div class="picture-word">
<div class="layer1">
<div class="layer_picture">
<img src="images/b1.jpg">
</div>
</div>
<div class="layer2">
<div class="layer_word">
<div class="layerword_1">Library</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer3">
<div class="layer_picture">
<img src="images/b2.jpg">
</div>
</div>
<div class="layer4">
<div class="layer_word">
<div class="layerword_1">Computer Lab</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer5">
<div class="layer_word">
<div class="layerword_1">Conference Hall</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer6">
<div class="layer_picture">
<img src="images/b3.jpg">
</div>
</div>
<div class="layer7">
<div class="layer_word">
<div class="layerword_1">Play Ground</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer8">
<div class="layer_picture">
<img src="images/b4.jpg">
</div>
</div>
</div>

  • picture-word限定尺寸定位
  • 关键:layer1..8各层均采用绝对定位,将全区等分为两层,每层等分4份
  • 关键:图或文字都采用相对定位,依次填坑,进而实现样式复用
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
<!--css-->
/*图文混排部分*/
.picture-word{
width:100%;
height: 720px;
position: absolute;
top:1120px;
left: 0px;
background-color: #07cbc9;
margin-top: 30px;
}
.picture-word .layer1{
width:25%;
position: absolute;
top:0;
left:0;
}

.picture-word .layer2{
width:25%;
position: absolute;
top:0;
left:25%;
}

.picture-word .layer3{
width:25%;
position: absolute;
top:0;
left:50%;
}
.picture-word .layer4{
width:25%;
position: absolute;
top:0;
left:75%;
}
.picture-word .layer5{
width:25%;
position: absolute;
top:50%;
left:0;
}
.picture-word .layer6{
width:25%;
position: absolute;
top:50%;
left:25%;
}
.picture-word .layer7{
width:25%;
position: absolute;
top:50%;
left:50%;
}
.picture-word .layer8{
width:25%;
position: absolute;
top:50%;
left:75%;
}
.picture-word img{
width: 100%;
position: relative;
top:0;
left: 0;
}
.picture-word .layer_word{
color: #ffffff;
margin-top: 40px;
margin-left: 40px;
}
.picture-word .layerword_1{

margin-bottom: 25px;
font-size: 30px;
}
.picture-word .layerword_2{
margin-bottom: 20px;
font-size: 12px;
}
.picture-word .layerword_3{
margin-bottom: 20px;
font-size: 10px;
color: #D3D3D3;
}
.picture-word .layerword_button{
width: 70px;
height: 35px;
margin-top: 25px;
color: #ffffff;
background-color: #333;
position: relative;
left: 50%;
margin-left: -50px;
cursor: pointer;
}

五、gallery区

10

  • gallery盒子限定该区尺寸定位
  • 分为gallery-title、title-line、gallery-desc、gallery-picture_1..6几大部分
  • gallery-picture_1再次细分为img和gallery-word两部分
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
<!--html-->
<!-- gallery区 -->
<div class="gallery">
<div class="gallery-title">GALLERY</div>
<div class="title-line"></div>
<div class="gallery-desc">Lorem Ipsum is simply dummy text of the printing and typesetting <br>industry.Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s.</div>
<div class="gallery-picture_1">
<img src="images/03-01.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;SCIENCE LAB</div>
</div>
<div class="gallery-picture_2">
<img src="images/03-02.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;INDOOR STADIUM</div>
</div>
<div class="gallery-picture_3">
<img src="images/03-03.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;TRANSPORTATION</div>
</div>
<div class="gallery-picture_4">
<img src="images/03-04.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;KIDS ROOM</div>
</div>
<div class="gallery-picture_5">
<img src="images/03-05.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;MEDITATION CLASSES</div>
</div>
<div class="gallery-picture_6">
<img src="images/03-06.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;KIDS PLAY GROUND</div>
</div>
</div>
  • gallery-title、title-line、gallery-desc部分与about区域样式雷同,本可以代码复用,本demo中仅复制修改代码,还有修改的空间
  • gallery-picture_1..6部分的思路与picture-word区的排布雷同,此处也不再赘述
  • 排布不同之处在于,未将gallery宽度等分,各gallery-picture的width仅为32%,但是偏移位置仍然是33.3%及66.7%,由此实现了相邻图片之间的间隙,也是一种解决问题的思路
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
<!--css-->
/*gallery区*/
.gallery{
width: 60%;
margin-top: 40px;
margin-bottom: 40px;
position: absolute;
top: 1830px;
left: 20%;
text-align: center;
}
.gallery .gallery-title{
text-align: center;
font-size: 25px;
font-weight: bolder;
margin-top:20px;
margin-bottom: 5px;
}
.gallery .gallery-desc{
text-align: center;
width:100%;
font-size: 10px;
color: grey;
margin-top: 13px;
margin-bottom: 20px;
}
.gallery .gallery-picture_1{
width: 32%;
position: absolute;
top:130px;
left:0;
}
.gallery .gallery-picture_2{
width: 32%;
position: absolute;
top:130px;
left:33.3%;
}
.gallery .gallery-picture_3{
width: 32%;
position: absolute;
top:130px;
left:66.7%;
}
.gallery .gallery-picture_4{
width: 32%;
position: absolute;
top:370px;
left:0;
}
.gallery .gallery-picture_5{
width: 32%;
position: absolute;
top:370px;
left:33.3%;
}
.gallery .gallery-picture_6{
width: 32%;
position: absolute;
top:370px;
left:66.7%;
}
.gallery img{
width: 100%;
}
.gallery .gallery-word{
text-align:left;
width: 100%;
height: 35px;
background-color: #333;
position: relative;
top:-4px;
left:0;
font-size: 13px;
line-height: 35px;
color: #ffffff;
}

六、footer区

简单,此处不解释,看代码

1
2
<!--html-->
<div class="footer">© 2016 imooc.com 京ICP备13046642号</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!--css-->
/*footer层,效果垂直居中*/
.footer{
width: 100%;
height: 50px;
background-color: #07cbc9;
text-align: center;
line-height: 55px;
font-size: 12px;
color: #ffffff;
position: absolute;
top:2490px;
left:0;
}

完整项目源码:

index.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
<!--index.html文件如下-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Career Builder</title>
<link rel="stylesheet" type="text/css" href="index.css">

</head>
<body>
<!-- 标题及导航 -->
<div class="header">
<div class="logo"><img src="images/logo.png"></div>
<div class="nav">
<div class="nav-li">HOME</div>
<div class="nav-li">ABOUT</div>
<div class="nav-li">GALLERY</div>
<div class="nav-li">FACULTY</div>
<div class="nav-li">EVENTS</div>
<div class="nav-li">CONTACT</div>
</div>
</div>
<!-- 横幅栏,图片、遮挡、表格 -->
<div class="banner">
<div class="bannerP"><img src="images/banner3.jpg"></div>
<div class="toplayer"></div>
<div class="toplayer-top">
<ul class="personMsg">
<li><input type="text" class="Msg1" value=" your Name"></li>
<li><input type="text" class="Msg1" value=" your Phone"></li>
<li><input type="text" class="Msg1" value=" your Email"></li>
<li><input type="text" class="Msg2" value=" Write Your Comment Here"></li>
<button class="Msg3" type="summit">SEND MESSAGE</button>
</ul>
</div>
</div>
<!-- about区 -->
<div class="about">
<div class="about-title">ABOUT</div>
<div class="title-line"></div>
<div class="about-desc">Lorem Ipsum is simply dummy text of the printing and typesetting <br>industry.Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s.</div>
<div class="about-content">
<div class="content-explore">
<div class="explore-title">A WORD <br>ABOUT US</div>
<div class="explore-block">
<div class="block-word">Praesent dignissim viverra est,sed<br>bibendum ligula congue non.Sed ac nisl<br>
et felis gravida commodo? Suspendisse <br>eget ullamcorper ipsum.Suspendisse<br>diam amet.</div>
<button class="block-button">EXPLORE</button>
</div>
</div>
<div class="content-img">
<img src="images/bb3.jpg">
</div>
<div class="content-count">
<div class="count1">
<div class="num">70000</div>
<div class="title-line"></div>
<div class="name">Students</div>
</div>
<div class="count2">
<div class="num">600</div>
<div class="title-line"></div>
<div class="name">Faculty</div>
</div>
</div>
</div>
</div>
<!-- picture-word区 -->
<div class="picture-word">
<div class="layer1">
<div class="layer_picture">
<img src="images/b1.jpg">
</div>
</div>
<div class="layer2">
<div class="layer_word">
<div class="layerword_1">Library</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer3">
<div class="layer_picture">
<img src="images/b2.jpg">
</div>
</div>
<div class="layer4">
<div class="layer_word">
<div class="layerword_1">Computer Lab</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer5">
<div class="layer_word">
<div class="layerword_1">Conference Hall</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer6">
<div class="layer_picture">
<img src="images/b3.jpg">
</div>
</div>
<div class="layer7">
<div class="layer_word">
<div class="layerword_1">Play Ground</div>
<div class="layerword_2">Lorem Ipsum is simply dummy text of the
<br>printing and typesetting industry.</div>
<div class="layerword_3">Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s,when an unknown printer took <br> a galley of type and scrambled it to make a type <br> specimen book.</div>
<button class="layerword_button">EXPLORE</button>
</div>
</div>
<div class="layer8">
<div class="layer_picture">
<img src="images/b4.jpg">
</div>
</div>
</div>
<!-- gallery区 -->
<div class="gallery">
<div class="gallery-title">GALLERY</div>
<div class="title-line"></div>
<div class="gallery-desc">Lorem Ipsum is simply dummy text of the printing and typesetting <br>industry.Lorem
Ipsum has been the industry's standard dummy <br>text ever since the 1500s.</div>
<div class="gallery-picture_1">
<img src="images/03-01.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;SCIENCE LAB</div>
</div>
<div class="gallery-picture_2">
<img src="images/03-02.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;INDOOR STADIUM</div>
</div>
<div class="gallery-picture_3">
<img src="images/03-03.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;TRANSPORTATION</div>
</div>
<div class="gallery-picture_4">
<img src="images/03-04.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;KIDS ROOM</div>
</div>
<div class="gallery-picture_5">
<img src="images/03-05.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;MEDITATION CLASSES</div>
</div>
<div class="gallery-picture_6">
<img src="images/03-06.jpg">
<div class="gallery-word">&nbsp;&nbsp;&nbsp;KIDS PLAY GROUND</div>
</div>
</div>
<!-- footer区 -->
<div class="footer">© 2016 imooc.com 京ICP备13046642号</div>
</body>
</html>

index.css文件如下:

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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
*{
padding:0;
margin: 0;
font-family: "Microsoft YaHei UI";
}

/*标题及导航*/
.header {
width: 100%;
height: 48px;
background-color: #07cbc9;
}
.header .logo {
width:260px;
height:48px;
float: left;
margin-left: 90px;
}
.header .nav{
height:48px;
float: right;
color: #ffffff;
margin-right:90px;
}
.header .nav .nav-li{
background-color:#07cbc9;
float: left;
font-size: 12px;
line-height: 48px;
margin-left: 10px;
margin-right: 5px;
padding-left: 5px;
padding-right: 5px;
}
.header .nav .nav-li:hover{
background-color: #333;
cursor: pointer;
}

/*横幅层*/
.banner {
width: 100%;
position: absolute;
top:48px;
left: 0;
}
.banner .bannerP img{
width: 100%;

}
.banner .toplayer{
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
opacity: 0.5;
}
.banner .toplayer-top{
width: 30%;
position: absolute;
top:20%;
left: 35%;
/*margin-left: -25%;
margin-top: -25%;*/
z-index: 2;
}
.banner .personMsg{
padding-top: 10px;
line-height: normal;
list-style: none;
}
.banner .personMsg .Msg1,.Msg2,.Msg3{
background-color: transparent;
width: 100%;
font-size: 12px;
color: #D3D3D3;
border: 2px solid grey;
margin: 10px;
}
.banner .personMsg .Msg1{
height: 30px;
}
.banner .personMsg .Msg2{
height: 100px;
}
.banner .personMsg .Msg3{
width: 40%;
height: 30px;
margin-left: 30%;
text-align: center;
cursor: pointer;
}

/*about区*/
.about{
width: 70%;
/* background-color: orange;*/
position: absolute;
left: 15%;
/* top:730px;*/
top:90%;
}
.about .about-title{
text-align: center;
font-size: 25px;
font-weight: bolder;
margin-top:20px;
margin-bottom: 5px;
}
.title-line{
width:20px;
line-height: 1px;

border-bottom-style: solid ;
border-color: #07cbc9;
position: relative;
left: 50%;
margin-left: -10px;
}
.about .about-desc{
text-align: center;
width:100%;
font-size: 10px;
color: grey;
margin-top: 13px;
margin-bottom: 13px;
}
.about .about-content{
width: 100%;
margin-bottom: 200px;
}
.about .about-content .content-explore{
width: 28%;
float: left;
z-index: 2;
margin-left: 10%;
position: relative;
top:0;
left: 2%;
}
.about .about-content .content-explore .explore-title{
text-align: left;
margin-left: 15px;
}
.about .about-content .content-explore .explore-block{
text-align: left;
font-size: 12px;
position: relative;
top:0;
left: 0;
border: 1px solid #D3D3D3;
margin-top: 5px;
padding: 10px;
/*background-color: #ffffff;
opacity: 0.5;*/
background-color: rgba(255, 255, 255, 0.4);
}
.about .about-content .content-explore .explore-block .block-word{
/*margin:5px;*/
margin-left: 5px;
margin-top: 5px;

}
.about .about-content .content-explore .block-button{
width: 60px;
height:30px;
margin:5px;
background-color: #333;
color: #ffffff;
cursor: pointer;
}
.about .about-content .content-img img{
width: 40%;
float: left;
position: absolute;
top:120px;
left:280px;
}
.about .about-content .content-count{
width: 20%;
float: left;
text-align: center;
position: relative;
top:0;
left: 35%;
}
.about .about-content .content-count .count1{
width: 120px;
height: 80px;
border: 1px solid #07cbc9;
margin:10px;
}
.num{
margin:10px auto;
}
.name{
margin: 10px auto;
font-size: 14px;
}
.about .about-content .content-count .count2{
width: 120px;
height: 80px;
border: 1px solid #07cbc9;
margin:10px;
}
/*图文混排部分*/
.picture-word{
width:100%;
height: 720px;
position: absolute;
top:1120px;
left: 0px;
background-color: #07cbc9;
margin-top: 30px;
}
.picture-word .layer1{
width:25%;
position: absolute;
top:0;
left:0;
}

.picture-word .layer2{
width:25%;
position: absolute;
top:0;
left:25%;
}

.picture-word .layer3{
width:25%;
position: absolute;
top:0;
left:50%;
}
.picture-word .layer4{
width:25%;
position: absolute;
top:0;
left:75%;
}
.picture-word .layer5{
width:25%;
position: absolute;
top:50%;
left:0;
}
.picture-word .layer6{
width:25%;
position: absolute;
top:50%;
left:25%;
}
.picture-word .layer7{
width:25%;
position: absolute;
top:50%;
left:50%;
}
.picture-word .layer8{
width:25%;
position: absolute;
top:50%;
left:75%;
}
.picture-word img{
width: 100%;
position: relative;
top:0;
left: 0;
}
.picture-word .layer_word{
color: #ffffff;
margin-top: 40px;
margin-left: 40px;


}
.picture-word .layerword_1{

margin-bottom: 25px;
font-size: 30px;
}
.picture-word .layerword_2{
margin-bottom: 20px;
font-size: 12px;
}
.picture-word .layerword_3{
margin-bottom: 20px;
font-size: 10px;
color: #D3D3D3;
}
.picture-word .layerword_button{
width: 70px;
height: 35px;
margin-top: 25px;
color: #ffffff;
background-color: #333;
position: relative;
left: 50%;
margin-left: -50px;
cursor: pointer;
}
/*gallery区*/
.gallery{
width: 60%;
margin-top: 40px;
margin-bottom: 40px;
position: absolute;
top: 1830px;
left: 20%;
text-align: center;
}
.gallery .gallery-title{
text-align: center;
font-size: 25px;
font-weight: bolder;
margin-top:20px;
margin-bottom: 5px;
}
.gallery .gallery-desc{
text-align: center;
width:100%;
font-size: 10px;
color: grey;
margin-top: 13px;
margin-bottom: 20px;
}
.gallery .gallery-picture_1{
width: 32%;
position: absolute;
top:130px;
left:0;
}
.gallery .gallery-picture_2{
width: 32%;
position: absolute;
top:130px;
left:33.3%;
}
.gallery .gallery-picture_3{
width: 32%;
position: absolute;
top:130px;
left:66.7%;
}
.gallery .gallery-picture_4{
width: 32%;
position: absolute;
top:370px;
left:0;
}
.gallery .gallery-picture_5{
width: 32%;
position: absolute;
top:370px;
left:33.3%;
}
.gallery .gallery-picture_6{
width: 32%;
position: absolute;
top:370px;
left:66.7%;
}
.gallery img{
width: 100%;
}
.gallery .gallery-word{
text-align:left;
width: 100%;
height: 35px;
background-color: #333;
position: relative;
top:-4px;
left:0;
font-size: 13px;
line-height: 35px;
color: #ffffff;
}
.footer{
width: 100%;
height: 50px;
background-color: #07cbc9;
text-align: center;
line-height: 55px;
font-size: 12px;
color: #ffffff;
position: absolute;
top:2490px;
left:0;
}

本人原创,转载请注明出处,谢谢!

-------------The End-------------