Beispiel:Tic-tac-toe-spielstand.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" type="text/css" media="screen" href="./Beispiel:Grundlayout.css" />
<title>Tic-Tac-Toe (unfertig, Spielstand)</title>
<style type="text/css">
.tic-tac-toe table {
border: 2px solid black;
border-collapse: collapse;
}
.tic-tac-toe td {
border: 1px solid black;
height: 5em;
position: relative;
text-align: center;
width: 5em;
}
.tic-tac-toe table:not(.game-over) td {
cursor: pointer;
}
.tic-tac-toe td button {
position: absolute;
left: -100vw;
}
.tic-tac-toe .o {
background: #8f8;
color: #8f8;
}
.tic-tac-toe .x {
background: #f88;
color: #f88;
}
.tic-tac-toe table:not(.game-over) .o,
.tic-tac-toe table:not(.game-over) .x {
z-index: -1;
}
.tic-tac-toe .o::after,
.tic-tac-toe .x::after {
color: black;
display: block;
font-size: 5em;
position: absolute;
width: 100%;
}
.tic-tac-toe .o::after {
content: "○";
top: -0.2em;
}
.tic-tac-toe .x::after {
content: "×";
top: -0.125em;
}
</style>
</head>
<body>
<h1>Tic-Tac-Toe (unfertig, Spielstand)</h1>
<aside class="tic-tac-toe">
<p>Zum Spielen bitte abwechselnd in die Spielfelder klicken/tappen!</p>
<table>
<caption>Spieler x ist am Zug.</caption>
<tbody>
<tr>
<td class="x">x</td>
<td><button>wählen</button></td>
<td><button>wählen</button></td>
</tr>
<tr>
<td><button>wählen</button></td>
<td class="o">o</td>
<td><button>wählen</button></td>
</tr>
<tr>
<td><button>wählen</button></td>
<td><button>wählen</button></td>
<td><button>wählen</button></td>
</tr>
</tbody>
</table>
</aside>
</body>
</html>