Beispiel:CSS-Hero-2.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Hero-Images - 2</title>
    <style>
html, body {
    margin: 0;
}

html {
    height: 100vh; 
    overflow-y: hidden;	
    background-image: url("https://wiki.selfhtml.org/images/e/e4/TotemPole-2000.jpg"); /*Fallback */
    background-image: webkit-image-set(
        url("https://wiki.selfhtml.org/images/2/23/TotemPole-2000.jpg") 1x,
        url("https://wiki.selfhtml.org/images/9/99/TotemPole-4096.jpeg") 2x
        );
    background-image: image-set(
        url("https://wiki.selfhtml.org/images/2/23/TotemPole-2000.jpg") 1x,
        url("https://wiki.selfhtml.org/images/9/99/TotemPole-4096.jpeg") 2x
        );
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}

h1 {
    position:absolute;
    margin-left: auto;
    margin-right: auto;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 4em;
    color: navy;
}
footer {
    position: absolute;
    bottom: 0.5em;
    right: 1em;
    color: white;
}
</style>
</head>
<body>
    <h1>Hero-Image mit <code>image-set()</code></h1>
<footer>
<a rel="license" hreF="https://commons.wikimedia.org/wiki/File:USA_10315_Monument_Valley_Luca_Galuzzi_2007.jpg">Monument Valley von Luca Galuzzi</a>  (CC BY-SA 3.0)
</footer>
</body>
</html>