Axel Richter: Z-U-S-A-T-Z-F-R-A-G-E Mehrere absolute Elemente in einem großen

Beitrag lesen

Hallo,

Um im selben Thread zu bleiben hier eine Unterfrage:
<div style="position:relative;">
       <div style="position:absolute;"> foo </div>
       <div style="position:absolute;"> bar </div>
       <div style="position:absolute;"> bazz </div>
       <div style="position:absolute;"> bleh </div>
</div>
Was könnte man mit so einer Verschachtelung aufführen?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Wuerfel</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
<!--
#wuerfel {position:relative; width:100px; height:100px; background-color:#000; border:15px solid #000;}
.punkt {position:absolute; width:16px: height:16px;}
#p1 {top:0; left:0;}
#p2 {top:0; right:0;}
#p3 {top:42px; left:0;}
#p4 {top:42px; right:0;}
#p5 {bottom:0; left:0;}
#p6 {bottom:0; right:0;}
#p7 {top:42px; left:42px;}
-->
</style>
</head>
<body>
<div id="wuerfel">
 <img class="punkt" id="p1" src="b01.gif" alt="Punkt1" title="" width="16" height="16">
 <img class="punkt" id="p2" src="b01.gif" alt="Punkt2" title="" width="16" height="16">
 <img class="punkt" id="p3" src="b01.gif" alt="Punkt3" title="" width="16" height="16">
 <img class="punkt" id="p4" src="b01.gif" alt="Punkt4" title="" width="16" height="16">
 <img class="punkt" id="p5" src="b01.gif" alt="Punkt5" title="" width="16" height="16">
 <img class="punkt" id="p6" src="b01.gif" alt="Punkt6" title="" width="16" height="16">
 <img class="punkt" id="p7" src="b01.gif" alt="Punkt7" title="" width="16" height="16">
</div>
</body>
</html>

Aufgabe:
Zu erstellen ist ein Würfelspiel mit Hilfe eines BUTTON-Elements und JavaScript in Verbindung mit der CSS-Eigenschaft http://de.selfhtml.org/css/eigenschaften/positionierung.htm#visibility. Hinweis: Nutzen Sie http://de.selfhtml.org/javascript/objekte/math.htm#random und ein Array, in dem Sie die Zuordnung der Würfelpunkte zu den Zahlen 1-6 speichern.

viel Spass ;-))

Axel