-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path浮动窗口.html
53 lines (46 loc) · 1.19 KB
/
浮动窗口.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>浮动效果float样式</title>
<style type="text/css">
/* float样式是用来设置当前元素在父元素当中的浮动 顶级父元素为浏览器界面*/
#outdiv {
width: 300px;
height: 300px;
background-color: red;
/* 设置当前接节点元素的浮动效果,此时没有父类盒子,在浏览器中进行浮动 */
float: right;
}
#innerdiv {
width: 100px;
height: 100px;
background-color: blue;
/* 内盒子浮动于外盒子的右侧 */
/* 设置当前节点元素的浮动效果,只是浮动于当前元素的父元素内部。 */
float: right;
}
#mydiv2 {
width: 100px;
height: 100px;
background-color: red;
/* 绝对定位 */
/* 这个代表该元素离浏览器顶部为0px,离左侧为0px,也可以理解为该元素在浏览器左上角 */
top: 0px;
left: 0px;
}
</style>
</head>
<body>
<!-- 浮动效果float样式 -->
<!-- 外部div -->
<div id="outdiv">
<!-- 内部div -->
<div id="innerdiv">
</div>
</div>
<!-- 绝对定位 -->
<div id="mydiv2">
</div>
</body>
</html>