Ich war mir nicht sicher, ob das Flexlayout mit relativer/absoluter Positionierung und z-index zusammen funktioniert, aber ein Versuch zeigt, dass es das problemlos tut:
Code
<div id="alert">
<div id="kopf">Das ist ein Alert</div>
<div id="kreis">
</div>
<div id="inhalt">Dies ist der Inhalt</div>
<button id="close">Schliessen</button>
<img id="drop" src="https://www.mediaevent.de/javascript/img/drop.png">
</div>
<style>
#alert {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
width: 50%;
margin: auto;
border: 1px solid black;
height: 50vh;
background-color: lightgrey;
}
#alert > * {
position: relative;
}
#drop {
position: absolute;
left: calc(50% - 54px);
top: 0;
animation: drop 4s infinite linear;
}
#kopf {
align-self: stretch;
background-color: blue;
color: white;
padding: 5px;
text-align: center;
margin-bottom: auto;
z-index: 5;
}
#kreis {
width: 100%;
height: 30%;
background-color: lightgreen;
background-image: url(http://www.mediaevent.de/javascript/img/circle.png);
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
}
#inhalt {
align-self: stretch;
text-align: center;
background-color: lightsalmon;
z-index: 5;
}
#close {
margin-top: auto;
}
@keyframes drop {
0% {
top: -180px;
opacity: 1;
}
90% {
top: 100%;
opacity: 1;
}
100% {
top: 100%;
opacity: 0;
}
}
</style>
Alles anzeigen
Ich habe dies auf einer Testseite entwickelt, damit mir die Features meines Editors zur Verfügung stehen (Validierung etc.).