File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 " />
5
+ < title > Position</ title >
6
+ < style >
7
+ html {
8
+ background : # ccc ;
9
+ margin : 0 ;
10
+ padding : 0 ;
11
+ }
12
+ body {
13
+ background : white;
14
+ width : 800px ;
15
+ margin : 0 auto;
16
+ padding : 1em ;
17
+ }
18
+ h1 {
19
+ margin : 0 ;
20
+ padding : 1em 0 ;
21
+ }
22
+ .outer {
23
+ height : 500px ;
24
+ width : 500px ;
25
+ background : blue;
26
+ }
27
+ .outer p {
28
+ color : white;
29
+ }
30
+ .inner {
31
+ height : 100px ;
32
+ width : 100px ;
33
+ background : red;
34
+ }
35
+ </ style >
36
+ </ head >
37
+ < body >
38
+ < h1 > Positioning</ h1 >
39
+ < div class ="outer ">
40
+ < div class ="inner "> </ div >
41
+ < p > Here is some text inside a blue box.</ p >
42
+ </ div >
43
+ < h2 > Things to Try:</ h2 >
44
+ < ul >
45
+ < li > .inner {position: relative; left: 10px}</ li >
46
+ < li > .inner {position: relative; right: 10px}</ li >
47
+ < li > .inner {position: relative; right: -10px}</ li >
48
+ < li > .inner {position: relative; top: 10px}</ li >
49
+ < li > .inner {position: absolute; top: 10px}</ li >
50
+ < li > .outer {position: relative} .inner {position: absolute; top: 10px}</ li >
51
+ < li > .outer {position: relative} .inner {position: absolute; top: 10px; bottom: 20px;} (and unset the height on .inner)</ li >
52
+ < li > .outer {position: relative} .inner {position: relative; top: 10px}</ li >
53
+ </ ul >
54
+ </ body >
55
+ </ html >
You can’t perform that action at this time.
0 commit comments