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 56 57 58 59 60 61 62 63 64
| <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Décalage contenu</title>
<meta name="Author" content="NoSmoking">
<meta name="DVP-discussion" content="d2054001">
<meta name="description" content="Décalage contenu vers le bas à l'ouverture de la page.">
<style>
html, body {
margin: 0;
padding: 0;
min-height: 100vh;
font: 1em/1.5 Verdana,sans-serif;
}
body {
position: relative;
background-color: #CDE;
background-attachment: fixed;
background-image: url(https://cyberzoide.developpez.com/misc/background12-1600x1200.jpg);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
header {
position: fixed;
top: 0;
right: 0;
left: 0;
color: #FFF;
background: rgba(64,128,240,.6);
}
.chapitre {
margin: calc(100vh - 5em) auto 0;
padding: 1em;
max-width: 60em;
color: #FFF;
background-color: rgba(0,0,0,.6);
}
.chapitre p {
margin: 0;
padding: 1em 1em 5em;
}
</style>
</head>
<body>
<main>
<header>
<h1>Titre de la page</h1>
</header>
<section class="chapitre">
<h2>La lecture c'est ici ...</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ultricies laoreet orci, sit amet molestie nulla efficitur ac. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas tellus elit, suscipit at laoreet et, tempor a orci. Nulla in tortor nec est placerat condimentum in nec magna. Nunc sollicitudin sem eget purus ultrices, bibendum pharetra augue aliquet. Mauris consectetur lectus ut laoreet finibus. In gravida, massa eget tempus fringilla, eros nisi gravida massa, at accumsan massa nisl vel quam. Donec maximus molestie enim, ac elementum nisi posuere a. Vivamus eu varius erat.</p>
</section>
</main>
<script>
const copy = document.querySelector(".chapitre p");
for (let i = 0; i < 10; i += 1) {
copy.parentNode.appendChild(copy.cloneNode(true));
}
</script>
</body>
</html> |
Partager