przewiń do treści

HTML5 i CSS3. Praktyczne projekty

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 31.5. Pozycjonowanie względnie bezwzględne

Rozdział 31. Zaawansowane metody pozycjonowania elementów blokowych

31-05.txt

Reklama

Szkolenia z Symfony 2.1