z Indizes

Diskutiere z Indizes im CSS Forum im Bereich Programmierung; Hallo, wie kann der folgende code abgeändert werden damit bei Knopfdruck die indizes vertauscht werden? Tachu <!DOCTYPE html> <html...
  • z Indizes Beitrag #1
T
Tachu
Member
Beiträge
8
Punkte Reaktionen
0
Hallo,
wie kann der folgende code abgeändert werden damit bei Knopfdruck die indizes vertauscht werden?
Tachu

<!DOCTYPE html>
<html style="height:2000px">
<head>
<style>
.changeToGreen-button {
background-color: red;
color: white;
border: none;
height: 36px;
width: 105px;
border-radius: 2px;
cursor: pointer;
margin-right: 8px;
transition: opacity 0.15s;
}

.changeToGreen-button:hover {
opacity: 0.8;
}
.changeToGreen-button:active {
opacity: 0.5;
/*switch z-indices*/
}

.changeToYellow-button {
background-color: red;
color: white;
border: none;
height: 36px;
width: 105px;
border-radius: 2px;
cursor: pointer;
margin-right: 8px;
transition: opacity 0.15s;
}

.changeToYellow-button:hover {
opacity: 0.8;
}
.changeToYellow-button:active {
opacity: 0.5;
/*switch z-indices*/
}

}
</style>
</head>

<body >


<div style="
position:absolute;
width:400px;
height:300px;
z-index:2;
background-color: yellow;
top:50px;
left:150px;
">
<button class="changeToGreen-button">
Change to green
</button>
</div>

<div style="
position:absolute;
width:400px;
height:300px;
z-index:1;
background-color: green;
top:50px;
left:150px;
">
<button class="changeToYellow-button">
Change to yellow
</button>
</div>

</body>
</html>
 
  • z Indizes Beitrag #2
S
scatello
Well-known member
Beiträge
528
Punkte Reaktionen
44
JavaScript ist dein Freund. ;)
 
  • z Indizes Beitrag #3
T
Tachu
Member
Beiträge
8
Punkte Reaktionen
0
Ich hab's schon geahnt. Ist es sicher, dass es mit CSS nicht geht?
 
  • z Indizes Beitrag #5
S
Sempervivum
Well-known member
Beiträge
760
Punkte Reaktionen
125
Zuletzt bearbeitet:
Thema:

z Indizes

Oben Unten