przewiń do treści

HTML, XHTML i CSS. Praktyczne projekty. Wydanie II

Włodzimierz Gajda

div {
    border: 1px solid black;
    background: aqua;
    width: 500px;
    height: 200px;
    position: relative;
}
h1  {
    margin: 0;

    background: black;
    color: white;

    width: 200px;
    height: 50px;

    position: absolute;
    left: 50px;
    top: 20px;
}
h2  {
    margin: 0;

    background: black;
    color: white;

    width: 150px;
    height: 50px;

    position: absolute;
    left: 300px;
    top: 120px;
}
...
<body>
<div>
    <h1>Lorem ipsum</h1>
    <h2>Dolor sit amet</h2>
</div>
</body>

Listing 19.5. Pozycjonowanie względnie bezwzględne

Rozdział 19. Zaawansowane metody pozycjonowania elementów blokowych

listing-19-05.txt