Beispiel:Hero-5.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 - image-set()</title>

   <style>

html, body {

   margin: 0;

}

html {

   height: 100dvh; 
   overflow-y: hidden;	
   background-image: url("https://wiki.selfhtml.org/images/e/e4/TotemPole-2000.jpg"); /*Fallback */
   background-image: image-set(

url("https://wiki.selfhtml.org/images/2/23/TotemPole-1200.jpg") 1x,

       url("https://wiki.selfhtml.org/images/e/e4/TotemPole-2000.jpg") 2x,
       url("https://wiki.selfhtml.org/images/9/99/TotemPole-4096.jpeg") 3x
       );
   background-size: cover;
   background-repeat: no-repeat;
   background-position: center center;

}

body {

   min-block-size: 100vh;
   display: grid;
   grid-template-rows: 1fr min-content;

}

h1 {

 justify-self: center;
 text-align: center;
 color: navy;
 text-shadow: 0 2px 6px rgb(0 0 0 /0.6); 
 font-size: 4em;

} footer {

 justify-self: center;
 padding: 1em;
 color: white;

}

footer a {

 color: skyblue;

} </style> </head> <body>

Hero-Image mit image-set()

<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>