0%

前端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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
div{
width: 313px;
height: 400px;
border: 1px slategray solid;
border-radius: 10px;
padding: 40px;
margin: 0 auto;
line-height: 20px;
background: gainsboro;
}

.button{
width: 85px;
height: 25px;
background: transparent url("https://img1.baidu.com/it/u=166831438,1114233507&fm=253&fmt=auto&app=138&f=JPEG?w=439&h=194") center/85px 25px;
}

</style>
</head>
<body>
<div name="d1" >
<h1>请注册</h1>
<span style="color: gray">已有账号?</span>
<a href="#" style="text-decoration: none">登录</a> <br> <br>

<!-- 用户注册部分-->

<form action="" class="form" style="line-height: 40px;" >
用户名 <input type="text" name='user' placeholder="请输入用户名"
style="width: 252px;"> <br>
手机号 <select name="" id="" >
<option value="10010">10010</option>
<option value="10086">10086</option>
</select>
<input type="text" name="phone" placeholder="请输入手机号"
style="width: 187px"> <br>
&emsp;<input type="password" name="pwd" placeholder="请输入密码"
style="width: 252px"> <br>
验证码 <input type="text" name="yzm" placeholder="请输入验证码">
<input type="button" value=" " class="button"
style="color: gray"><br>
<p style="color: gray">
<input type="checkbox" value="xy">阅读并接受协议 <br>
</p>

<input type="submit" value="注&emsp;&emsp;&emsp;&emsp;册"
style="width: 315px;background: lightskyblue;border-radius: 5px">

</form>

</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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.box {
width: 400px;
height: 450px;
border: 1px solid rgb(217,216,216);
border-radius: 15px;
margin-top: 5%;
margin-left: 30%;
background-color: #e3e2e2;
}

h1, span {
margin-left: 20px;
}
span,a {
font-size: 14px;
}

span {
color: rgb(129,129,129);
}

a {
text-decoration: none;
}

.forme {
margin-left:20px;
color:black;
line-height:40px;
}

input {
border: 1px solid #e2e0e0;
border-radius: 3px;
height:25px;
}

.user,.pwd {
width: 270px;
height: 25px;
}

select {
border: 1px solid #e2e0e0;
border-radius: 3px;
height:27px;
}

.phone {
width: 202px;
}

.yzm {
width: 185px;
}

.ipt {
height:30px;
width:80px;
/* 垂直对齐*/
vertical-align: middle;
background: url('2.png') center/70px 30px;
}

.test {
/* 垂直对齐*/
vertical-align: middle;
}

.sp1 {
margin-left: -1px;
}

.zc {
width: 330px;
height: 35px;
background-color: skyblue;
color:white;
}
</style>
</head>
<body>
<div class="box">
<h1>请注册</h1>
<span>已有账号?</span>
<a href="#">登录</a> <br> <br>

<!-- 用户注册部分-->
<form action="" class="forme">
用户名 <input type="text" name='user' placeholder="请输入用户名" class="user"> <br>
手机号 <select name="" id="">
<option value="10010">10010</option>
<option value="10086">10086</option>
</select>
<input type="text" name="phone" placeholder="请输入手机号" class="phone"> <br>
&emsp;<input type="password" name="pwd" placeholder="请输入密码" class="pwd"> <br>
验证码 <input type="text" name="yzm" placeholder="请输入验证码" class="yzm">
<input type="button" class="ipt">
<br>
<input type="checkbox" value="xy" class="test"><span class="sp1">阅读并接受协议</span> <br>
<input type="submit" value="注册" class="zc">

</form>
</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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>旺财基金会</title>
<link rel="stylesheet" href="实例.css">
</head>
<body>
<div id="a1">
<div id="a2">
<h2>请注册</h2>
<p>
<span>已有帐号?</span>
<a href="https://www.baidu.com">登录</a>
</p>
</div>
<div id="a3">
<form action="https://www.baidu.com">
<span>账户名</span>
<input type="text" name="mi_nema" placeholder="请输入账户名" class="c1">
<br>
<span>手机号</span>
<select name="sjh" id="sjh">
<option value="1">+86</option>
</select>
<input type="text" name="mi_sjh" placeholder="请输入手机号">
<br>
<span>&emsp;</span>
<input type="password" name="mi_pas" placeholder="请输入密码" class="c1">
<br>
<span>验证码</span>
<input type="text" name="syzm" placeholder="请输入验证码">
<input type="button" value=" " name="tyzm">
<br>
<p>
<input type="checkbox">
<span>阅读并接受协议 </span>
</p>
<br>
<input type="submit" value="注册" id="zc">
</form>
</div>
</div>
</body>
</html>

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
#a1{
/*盒子大小 width:宽(x) height: 高(y)*/
width: 350px;
height: 550px;
/*盒子背景*/
/*background-color: cyan;*/
/*边框 颜色/大小/类型*/
border: black 1px solid;
/*边框的弧度 等于 50% 时会成一个圆*/
border-radius: 10px;
/*盒子位置 上 左 */
margin: 100px 60px;
/*设置背景 url 是路径 center 是居中处理/ 宽/ 高*/
background: url("https://tse2-mm.cn.bing.net/th/id/OIP-C.7L9-UomGzb26idUPhXY4FwHaHa?w=180&h=180&c=7&r=0&o=5&dpr=1.3&pid=1.7") center/350px 550px;
}

#a2,#a3{
/*设置距离,不让字体紧贴边框*/
margin: 10px;
}

#zc{
/*设置注册按钮*/
width: 326px;
height: 38px;
background-color: cyan;
}

.c1{
/*设置登录和密码的输入框*/
width: 260px;
height: 30px;
/*上*/
margin-top: 8px;
/*下*/
margin-bottom: 8px ;
/*!*z左*!*/
/*margin-left: 5px;*/
/*!*右*!*/
/*margin-right: 5px;*/
border-radius: 5px;
border: black 1px solid;
}

select[name=sjh]{
/*手机号下拉框*/
width: 43px;
height: 30px;
margin-top: 8px;
margin-bottom: 8px ;
border: black 1px solid;
border-radius: 3px;
}

input[name=mi_sjh]{
/*手机号输入框*/
width: 211px;
height: 30px;
margin-top: 8px;
margin-bottom: 8px ;
border-radius: 5px;
border: black 1px solid;
}

input[name=syzm]{
/*验证码输入框*/
width: 165px;
height: 30px;
margin-top: 8px;
margin-bottom: 8px ;
border-radius: 5px;
border: black 1px solid;
}

input[name=tyzm]{
/*验证码图片框*/
width: 90px;
height: 31px;
opacity: 1;
border: black 1px solid;
border-radius: 3px;
background: url("https://pic4.zhimg.com/v2-17a03b9627aa8f850628c14550a0544a_r.jpg") center/90px 23px;
}

a{
/*取消下划线*/
text-decoration:none
}

form input{
/*改变透明度*/
opacity: 0.5;
}

form p{
/*改变p标签的上下边距*/
margin-top: 5px;
margin-bottom: 5px ;
}

p span{
/*设置字体颜色*/
color: darkgray;
}