-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path10-position.html
55 lines (55 loc) · 1.38 KB
/
10-position.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Position</title>
<style>
html {
background: #ccc;
margin: 0;
padding: 0;
}
body {
background: white;
width: 800px;
margin: 0 auto;
padding: 1em;
}
h1 {
margin: 0;
padding: 1em 0;
}
.outer {
height: 500px;
width: 500px;
background: blue;
}
.outer p {
color: white;
}
.inner {
height: 100px;
width: 100px;
background: red;
}
</style>
</head>
<body>
<h1>Positioning</h1>
<div class="outer">
<div class="inner"></div>
<p>Here is some text inside a blue box.</p>
</div>
<h2>Things to Try:</h2>
<ul>
<li>.inner {position: relative; left: 10px}</li>
<li>.inner {position: relative; right: 10px}</li>
<li>.inner {position: relative; right: -10px}</li>
<li>.inner {position: relative; top: 10px}</li>
<li>.inner {position: absolute; top: 10px}</li>
<li>.outer {position: relative} .inner {position: absolute; top: 10px}</li>
<li>.outer {position: relative} .inner {position: absolute; top: 10px; bottom: 20px;} (and unset the height on .inner)</li>
<li>.outer {position: relative} .inner {position: relative; top: 10px}</li>
</ul>
</body>
</html>