Tło musi się znajdować w kontenerze - divie o wartości position: absolute (ażeby tło było za wszystkimi innymi wartswami strony).
Oto uproszczony szkielet strony:
Kod
<html>
<head>
<style type="text/css">
.background {
position: absolute;
z-index: -10;
width: 100px;
}
.background .top {
background: red;
height: 100px;
}
.background .center {
min-height: 100px;
background: green;
}
.background .bottom {
background: yellow;
height: 100px;
}
</style>
</head>
<body>
<div class="background">
<div class="top"></div>
<div class="center"></div>
<div class="bottom"></div>
</div>
<p>
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
</p>
</body>
</html>
<head>
<style type="text/css">
.background {
position: absolute;
z-index: -10;
width: 100px;
}
.background .top {
background: red;
height: 100px;
}
.background .center {
min-height: 100px;
background: green;
}
.background .bottom {
background: yellow;
height: 100px;
}
</style>
</head>
<body>
<div class="background">
<div class="top"></div>
<div class="center"></div>
<div class="bottom"></div>
</div>
<p>
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
Tresc strony<br />
</p>
</body>
</html>
No i teraz jak zrobić, aby środkowy div .center powiększał się analogicznie do ilości tekstu na stronie?