CSS - Modal-Fenster mit HTML5 und CSS3

Ganz ohne JavaScript lässt sich dieses Modal-Fenster öffnen und wieder schließen.

Siehe auch: CSS - Lightbox

X

Modal-Fenster

Dies ist ein modales Fenster, das mit HTML5 und CSS3 erstellt wurde.


<style>

.
modalDialog {
 
position: Fixed;
 
font-family: Verdana, Sans-Serif;
 
top: 0;
 
right: 0;
 
bottom: 0;
 
left: 0;
 
background-color: rgba(0, 0, 0, 0.6);
 
z-index: 99999;
 
opacity: 0;
 
transition: opacity 400ms ease-in;
 
pointer-events: None;
}

.
modalDialog:target {
 
opacity: 1;
 
pointer-events: Auto;
}

.
modalDialog > div {
 
width: 400px;
 
position: relative;
 
margin: 10% Auto;
 
padding: 5px 20px 13px 20px;
 
border-radius: 10px;
 
background-color: #FFFFFF;
 
background: linear-gradient(#FFFFFF, #999999);
 
cursor: Default;
}

.
close {
 
background-color: #606061;
 
color: #FFFFFF;
 
line-height: 25px;
 
position: Absolute;
 
right: -12px;
 
text-align: Center;
 
top: -10px;
 
width: 24px;
 
text-decoration: None;
 
font-weight: Bold;
 
border-radius: 12px;
 
box-shadow: 1px 1px 3px #000000;
}

.
close:hover {
 
background-color: #00D9FF;
}
</
style>

</
head>
<
body>

<
a href="#openModal">Modal-Fenster öffnen</a>

<
div id="openModal" class="modalDialog">
 <
div>
  <
a href="#close" title="Schließen" class="close">X</a>
  <
h2>Modal-Fenster</h2>
  <
p>Dies ist ein modales Fenster, das mit HTML5 und CSS3 erstellt wurde.</p>
 </
div>
</
div>

Bausteine

Eine zufällige Auswahl von „Bausteinen” aus den Bereichen CSS, PHP, JavaScript und MySQL.

CSS - Wertigkeiten verändern mit der !important-Regel

PHP - Ausgabe von Wörtern begrenzen

JavaScript - Anzahl der HTML-Tags

MySQL - Den nächsten und vorherigen Datensatz ermitteln