Beispiel:CSS2 top.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css" />
<title>top</title>
<style>
main {
position: relative;
}
section {
position: absolute;
left: 300px;
top: 100px;
width: 250px;
height: 380px;
background-color: #F1F3F4;
}
img {
position: absolute;
top: 180px;
}
p {
position: absolute;
top: 136px;
width: 208px;
background-color: #FFFFE0;
border: 1px solid #804000;
margin: 0;
padding: 10px;
}
</style>
</head>
<body>
<h1>Verwendung von <code>top</code></h1>
<main>
<p>
<img src="http://wiki.selfhtml.org/images/3/31/Hund.gif" width="208" height="181" alt="Hund">
</p>
<p>Dies ist ein absolut positionierter Text über einer
absolut positionierten Grafik.
</p>
<section>
<img src="http://wiki.selfhtml.org/images/3/31/Hund.gif" width="208" height="181" alt="Hund">
<p>Dies ist ein absolut positionierter Text über einer
absolut positionierten Grafik.
</p>
Dasselbe noch einmal, jetzt in einem
<code>section</code>-Element.
</section>
</main>
</body>
</html>