Beispiel:Grid-ausrichtung-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>responsive Bildergalerie</title>
 <style>

.gallery {

   display: grid;
   grid-template-columns: repeat(3, 1fr);
   gap: .5em;
   border: thin dotted red;

}

.gallery figure {

 display: grid;
grid-template-columns: 1fr 1fr;
gap: 2em;

margin: 0; /* sonst großer Rand wg. Default-Stylesheet */ }

.fullwidth {
   grid-column: 1 / -1;
   border: thin dotted hotpink;

} .gallery figure > img, .gallery figure >figcaption {

 border: thin solid;

}

.gallery figure > img {

   margin-left: 2em;

}

.gallery figure > figcaption {

   align-self: center;  /* oder stretch */
   padding: 1em;

} .gallery div {

   background: pink;
   text-align: center;

padding: 2em; }

</style> </head>

<body>

Bildunterschriften so groß wie Bild - mittig angeordnet

</body> </html>