Ver Mensaje Individual
  #33 (permalink)  
Antiguo 07/10/2009, 17:23
Avatar de deirdre
deirdre
 
Fecha de Ingreso: mayo-2009
Mensajes: 690
Antigüedad: 15 años
Puntos: 45
Respuesta: Tablas vs Divs: Yo creo que ganan las tablas!!!!

Añado un poco de leña al fuego:

Quitando todo lo general y dejando sólo lo específico, estos son los códigos:

DIVS + CSS
Código HTML:
<style type="text/css">
html, body {
	height: 100%;
	width: 100%;
	margin: 0;
}
#caja {
	display: table;
	height: 100%;
	width: 100%;
	position: relative;
}
.centrado {
	display: table-cell;
	vertical-align: middle;
	margin: 0 auto;
	height: 100%;
	width: 100%;
}
.texto {
	position: relative;
	top: 0;
	display: block;
	background-color: #f00;
	color: #fff;
	height: 30%;
}
</style>
<!-- -->
<div id="caja">
	<div class="centrado" style="*position: absolute;*top: 50%;*height: 30%">
		<span class="texto" style="*top: -50%;*height: 100%">
		Texto de prueba, más texto de prueba, otro texto de prueba y el último texto de prueba
		</span>
	</div>
</div> 
TABLA Y CSS
Código HTML:
<style type="text/css">
html, body {
	height: 100%;
	margin: 0;
}
.tabla {
	width: 100%; 
	height: 100%;
}
td {
	height: 100%; 
}
.texto {
	height: 30%;
	background-color: #f00;
	color: #fff;
}
</style>
<!-- -->
<table cellspacing="0" class="tabla" cellpadding="0">
	<tr>
		<td><div class="texto">Texto de prueba, más texto de prueba, otro texto de prueba y el último texto de prueba</div></td>
	</tr>
</table> 
Bye