Beispiel:Popover-3.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Popover - 3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="./Beispiel:Grundlayout.css">
<style>
[popover] {
background: #fffbf0;
border: thin solid #e7c157;
max-width: 20em;
position: absolute;
padding: 1rem;
}
#additional-info1 {
margin: 2rem auto;
}
#additional-info2 {
margin: 14rem auto;
}
.close-btn {
border: none;
border-radius: 0 0 0 8px;
background-color: #c82f04;
color: white;
cursor: pointer;
position: absolute;
right: 0.25rem;
font-size: 1.25em;
font-weight: bold;
padding: 0.25em 0.4em;
text-align: center;
top: 0.5rem;
}
.sr-only:not(:focus):not(:active) {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
body {
background-color: #999;
}
</style>
</head>
<body>
<h1>Popover manuell schließen</h1>
<button popovertarget="additional-info1"> → Popover 1</button>
<div id="additional-info1" popover=manual>
<h4>Zusatz-Info 1</h4>
<p>In einem HTML-Element mit popover-Attribut können weitere Informationen präsentiert werden.<p>
<button popovertarget="additional-info1" popovertargetaction="hide" class="close-btn">
<span aria-hidden="true">X</span>
<span class="sr-only">Schließen</span>
</button>
</div>
<button popovertarget="additional-info2"> → Popover 2</button>
<div id="additional-info2" popover=manual>
<h4>Zusatz-Info 2</h4>
<p>In einem HTML-Element mit popover-Attribut können weitere Informationen präsentiert werden.<p>
<button popovertarget="additional-info2" popovertargetaction="hide" class="close-btn">
<span aria-hidden="true">X</span>
<span class="sr-only">Schließen</span>
</button>
</div>
</body>
</html>