Beispiel:Bildergalerie-1.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
<style>
button {
width: 8em;
padding: 0.1em;
}
[popover] {
background: #fffbf0;
border: thin solid #dfac20;
max-width: 20em;
padding: 1rem;
margin: 2rem auto;
}
img {
padding: 0;
margin: 0;
width: 100%; /* Bild passt sich an verfügbaren Raum im li an */
}
figcaption {
text-align: center;
}
ul,li {
margin: 0.1em;
padding: 0.1em;
}
li {
display: inline-block;
list-style-type: none;
}
[role=note] {
border-left: medium solid #c82f04;
padding-left: 0.5em;
max-width: 40em;
}
[role=note]:before {
content: 'Beachten: ';
color: #c82f04;
font-weight: blod;
}
</style>
<title>Bildergalerie mit Popover - 1</title>
</head>
<body>
<h1>Bildergalerie mit Popover- 1</h1>
<ul id="galerie">
<li><button popovertarget="image1"><img src="//wiki.selfhtml.org/images/8/80/Dummy-1.jpg" alt="Spaß in der Sonne"></button></li>
<li><button popovertarget="image2"><img src="//wiki.selfhtml.org/images/e/e7/Dummy-2.jpg" alt="Berg im Morgennebel"></button></li>
<li><button popovertarget="image3"><img src="//wiki.selfhtml.org/images/c/c9/Dummy-3.jpg" alt="Spaß in der Sonne"></button></li>
<li><button popovertarget="image4"><img src="//wiki.selfhtml.org/images/8/8e/Dummy-4.jpg" alt="Korallenriff"></button></li>
<li><button popovertarget="image5"><img src="//wiki.selfhtml.org/images/1/1c/Dummy-5.jpg" alt="Morgensonne in Salo, Gardasee"></button></li>
<li><button popovertarget="image6"><img src="//wiki.selfhtml.org/images/6/61/Dummy-6.jpg" alt="Via Appia, Rom"></button></li>
</ul>
<figure id="image1" popover>
<img src="//wiki.selfhtml.org/images/8/80/Dummy-1.jpg" alt="Spaß in der Sonne">
<figcaption>Spaß in der Sonne</figcaption>
</figure>
<figure id="image2" popover>
<img src="//wiki.selfhtml.org/images/e/e7/Dummy-2.jpg" alt="Berg im Morgennebel">
<figcaption>Berg im Morgennebel</figcaption>
</figure>
<figure id="image3" popover>
<img src="//wiki.selfhtml.org/images/c/c9/Dummy-3.jpg" alt="Spaß in der Sonne">
<figcaption>Spaß in der Sonne</figcaption>
</figure>
<figure id="image4" popover>
<img src="//wiki.selfhtml.org/images/8/8e/Dummy-4.jpg" alt="Korallenriff">
<figcaption>Korallenriff</figcaption>
</figure>
<figure id="image5" popover>
<img src="//wiki.selfhtml.org/images/1/1c/Dummy-5.jpg" alt="Morgensonne in Salo, Gardasee">
<figcaption>Morgensonne in Salo, Gardasee</figcaption>
</figure>
<figure id="image6" popover>
<img src="//wiki.selfhtml.org/images/6/61/Dummy-6.jpg" alt="Via Appia, Rom">
<figcaption>Via Appia, Rom</figcaption>
</figure>
<p role="note">Die neue Popover API wird (Stand November 2023) von allen Browsern außer dem Firefox unterstützt. Für den Firefox ist ein Polyfill eingebaut, der in Zukunft entfernt werden kann.</p>
<script
src="https://cdn.jsdelivr.net/npm/@oddbird/popover-polyfill@latest"
crossorigin="anonymous"
defer
></script>
</body>
</html>