梦入琼楼寒有月,行过石树冻无烟

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
<style>
input[type=text] , select {
/*宽度*/
width: 100px;

/*边距*/
margin: 10px 0;

/*显示*/
display: inline-block;

/*边框*/
border: 2px solid whitesmoke;
/*半径*/
border-radius: 1px;
/*框尺寸*/
box-sizing: border-box;
}
input[type=submit] {
width: 100%;
background-color: blue;
color: white;
padding: 20px 20px;
margin: 10px 0;
border: none;
border-radius: 10px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #00008B;
}
div {
border-radius: 10px;
background-color: cadetblue;
padding: 10px;
}
</style>
<body>
<form action="http://zsdk.org.cn/">
<label for="name">Name</label>
<input type="text" id="name" name="inputname" placeholder="name...">

<label for="describe">Describe</label>
<input type="text" id="describe" name="inputdescribe" placeholder="Describe">

<input type="submit" value="Submit">
</form>
</body>

下划线表单渲染

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<style>
input[type=text] {
outline:medium;
width: 100%;
padding: 10px 0px;
margin: 10px 0;
box-sizing: border-box;
border: none;
border-bottom: 1px solid blue;
}
</style>
<body>
<form>
<label for="name">你的用户名称</label>
<input type="text" id="name" name="id">

</form>
</body>

聚焦后的表单颜色

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<style>
input[type=text] {
outline:medium;
width: 100%;
padding: 12px 0px;
margin: 10px 0;
box-sizing: border-box;
border: 1px solid blue;
}
input[type=text]:focus {
background-color: cornflowerblue;
}
</style>
<body>
<form>
<label for="name">请输入您的名称</label>
<input type="text" id="name" name="id" value="id">
</form>
</body>

收到焦点后的动画效果

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
<!DOCTYPE html>
<html>
<head>
<mata chearset="utf-8">
<title>Hello,world</title>
<style>
input[type=text] {
width: 100%;
padding: 20px 20px;
margin: 10px 0;
box-sizing: border-box;
border: 5px solid aqua;
-webkit-transition: 1s;
transition: 1s;
outline: none;
}
input[type=text]:focus {
border: 5px solid blue;
}
</style>
<body>
<form>
<input type="text" id="fname" name="name" value="name">
</form>
</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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello,world</title>
<style>
input[type=text] {
width: 100%;
box-sizing: border-box;
border: 1px solid aquamarine;
border-radius: 10px;
font-size: 10px;
background-color: white;
background-image: url('img/so.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 22px 20px 22px 70px;
-webkit-transition: 1s;
transition: 1s;
outline:medium;
}
input[type=text]:focus {
border: 2px solid blue;
}
</style>
<body>
<from>
<input type="text" name="search" placeholder="请输入搜索">
</from>
</body>

表单触发效果与动画

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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello,world</title>
<style>
input[type=text] {
width: 200px;
box-sizing: border-box;
border: 1px solid aquamarine;
border-radius: 10px;
font-size: 10px;
background-color: white;
background-image: url('img/so.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 22px 20px 22px 70px;
-webkit-transition: 1s;
transition: 1s;
outline:medium;
}
input[type=text]:focus {
border: 2px solid blue;
width: 100%;
}
</style>
<body>
<from>
<input type="text" name="search" placeholder="请输入搜索">
</from>
</body>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<style>
select {
width: 100px;
padding: 16px 20px;
border: none;
border-radius: 3px;
background-color: cornsilk;
}
</style>
<body>
<form>
<select id="language" name="language">
<option value="cn">China</option>
<option value="us">English</option>
</select>
</form>
</body>

去除表单触点边框(outline:medium;)

1
outline:medium;
⬅️ Go back