- Notifications
You must be signed in to change notification settings - Fork 27.3k
/
Copy path3_absolute-positioning.html
46 lines (37 loc) · 1.41 KB
/
3_absolute-positioning.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
<!DOCTYPE html>
<htmllang="en-US">
<head>
<metacharset="utf-8">
<metaname="viewport" content="width=device-width">
<title>Absolute positioning</title>
<style>
body {
width:500px;
margin:0 auto;
}
p {
background: aqua;
border:3px solid blue;
padding:10px;
margin:10px;
}
span {
background: red;
border:1px solid black;
}
.positioned {
position: absolute;
background: yellow;
top:30px;
left:30px;
}
</style>
</head>
<body>
<h1>Absolute positioning</h1>
<p>I am a basic block level element. My adjacent block level elements sit on new lines below me.</p>
<pclass="positioned">Now I'm absolutely positioned, I'm not playing by the rules any more!</p>
<p>We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our margins, not both.</p>
<p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. Overflowing inline elements <span>wrap onto a new line if possible — like this one containing text</span>, or just go on to a new line if not, much like this image will do: <imgsrc="long.jpg" alt="a wide but short section of a photo of several fabrics"></p>
</body>
</html>