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
| <!DOCTYPE html>
<html dir="ltr" lang="fr-FR">
<head>
<meta charset="UTF-8" />
<title>Changement couleur à ancre fixed</title>
<style type="text/css">
a {
display: block;
width: 8em;
height: 4em;
position: fixed;
color: white;
}
#to-green {
top: 0;
left: 0;
background: red;
}
#to-green:target {
background: green;
}
#to-red {
top: 4em;
left: 0;
background: gray;
}
p {
margin-left: 8em;
line-height: 8em;
}
</style>
</head>
<body>
<a id="to-green" href="#to-green">Passer au vert.</a>
<a id="to-red" href="#to-red">Passer au rouge.</a>
<p>
foo <br />
foo <br />
foo <br />
foo <br />
foo <br />
foo <br />
foo <br />
foo <br />
foo <br />
foo <br />
</p>
</body>
</html> |