Beispiel:CSS3 background-attachment.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" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
<title>background-attachment</title>
<style>
.fixed { background-attachment: fixed; }
.scroll { background-attachment: scroll; }
.local { background-attachment: local; }
div {
overflow: auto;
width: 167px;
height: 300px;
background-image: url("/mediawiki/images/6/61/Sonnenuntergang.jpg");
background-repeat: no-repeat;
border: thin solid;
font-size: 2em;
font-weight: normal;
}
figure{
display:inline-block;}
</style>
</head>
<body>
<h1>Fixierung des Hintergrundbildes mit <code>background-attachment</code></h1>
<figure>
<div class="fixed">
<p>Ganz viel Lorem Ipsum. Was tut man nicht alles, um Scrollbalken zu erhalten.
Ganz viel Lorem Ipsum. Was tut man nicht alles, um Scrollbalken zu erhalten.
</p>
</div>
<figcaption>fixed</figcaption>
</figure>
<figure>
<div class="scroll">
<p>Ganz viel Lorem Ipsum. Was tut man nicht alles, um Scrollbalken zu erhalten.
Ganz viel Lorem Ipsum. Was tut man nicht alles, um Scrollbalken zu erhalten.
</p>
</div>
<figcaption>scroll</figcaption>
</figure>
<figure >
<div class="local">
<p>Ganz viel Lorem Ipsum. Was tut man nicht alles, um Scrollbalken zu erhalten.
Ganz viel Lorem Ipsum. Was tut man nicht alles, um Scrollbalken zu erhalten.
</p>
</div>
<figcaption>local</figcaption>
</figure>
<p>In der linken Spalte sehen Sie nur dann ein Hintergrundbild, wenn Sie keinen zu großen Außenabstand nach links haben.</p>
</body>
</html>