Estou a estagiar numa empresa, e sou novo em web.
Estou a desenvolver um layout de site, que pretendo que tenha uma div centrada, na página, dentro de uma div pai, que deverá começar no inicio da tela e ter uma altura variável, consoante o tamanho da tela. Ou seja o tamanho da div pai deverá vir sempre até ao final da div filha.
O meu código de teste é o seguinte:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>teste</title>
<link rel="stylesheet" href="css/teste.css" type="text/css" media="all" />
<style>
html, body {height:100%;}
body {
margin:0;
padding:0;
background: #666;
font:75%/1.4 Verdana, Arial, Helvetica, sans-serif;
text-align:center;
}
.limites {
width:100%;
margin:0;
background: #CC3;
}
.box {background: #066;
height:600px;
margin-top:-300px;
left:50%;
position:absolute;
top:50%;
width:955px;
margin-left:-476px;
}
.clear {
height: 5px;
clear:both;
}
</style>
</head>
<body>
<div class="limites">
<div class="box"></div>
<div class="clear"></div>
</div>
</body>
</html>










