-
Notifications
You must be signed in to change notification settings - Fork 0
/
before-after.html
48 lines (48 loc) · 1.55 KB
/
before-after.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>before-after伪类测试</title>
</head>
<body>
<style>
body{
background: url(1.jpg) no-repeat left top /*这里本兽加了个图片背景,用以区分背景的半透明及内容的完全不透明*/
}
.test-div{
position: relative; /*日常相对定位(重要,下面内容也会介绍)*/
width:300px;
height: 120px;
padding: 20px 10px;
font-weight: bold;
}
.test-div:before{
position: absolute; /*日常绝对定位(重要,下面内容也会略带介绍)*/
content: ""; /*:before和:after必带技能,重要性为满5颗星*/
top:0;
left: 0;
width: 100%; /*和内容一样的宽度*/
height: 100%; /*和内容一样的高度*/
background: rgba(0,0,0,.5); /*给定背景黑色,透明度50%*/
z-index:-1 /*日常元素堆叠顺序(重要,下面内容也会略带介绍)*/
}
</style>
<!--这里容兽偷个懒,布局简单写写-->
<div class="test-div">
<table>
<tr>
<td>Name</td>
<td><input placeholder="your name" /></td>
</tr>
<tr>
<td>Password</td>
<td><input placeholder="your password" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" value="login" /></td>
</tr>
</table>
</div>
</body>
</html>