Mit display: flex stellst du Elemente nebeneinander, justify-content verteilt sie. Mit position: absolute setzt du ein Bild mit left und top an eine feste Stelle in seiner Box. Die Box braucht dafür position: relative.
| #leiste { display: flex; } | ← Kinder stehen nebeneinander |
| #leiste { justify-content: space-between; } | ← Ganz links und ganz rechts |
| #box { position: relative; } | ← Die Box ist der Bezugspunkt |
| #ball { position: absolute; left: 20px; top: 40px; } | ← 20px von links, 40px von oben in der Box |
#kopf
Fang den Stern
Punkte: 0
Start
flex-direction
justify-content
#kopf { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; }