Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/11/2008, 17:15
Avatar de Mikmoro
Mikmoro
Colaborador
 
Fecha de Ingreso: octubre-2006
Ubicación: K-pax
Mensajes: 7.228
Antigüedad: 17 años, 6 meses
Puntos: 280
Respuesta: Centrar Tabla con css

Cita:
Iniciado por gVenom Ver Mensaje
Es increible que todas las respuestas a esta pregunta que me encontre en este foro fueran viejisimas (2005) y la única que me encontre por ahi que utilizaba un div style, no funciona en firefox. Alguien sabe como centrar una tabla de html con css y que sea compatible con los nuevos parametros del W3C?
Has tenido mala suerte con el buscador (a veces cuesta), porque esto se ha respondido varias veces últimamente. Yo diría que la alternativa que te dan es correcta:

Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es-es">
<head>
<title>Tabla</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
table.pagina {margin: 0 auto;}
</style>
</head>
<body>
<table width="500" border="1" class="pagina">
<tr>
<td>un texto</td>
<td>Aquí más texto</td>
<td>y un poco más</td>
</tr>
</table>
</body>
</html>
Pero... ¿por qué te refieres al doctype? con el que has puesto, el align en la tabla sigue siendo perfectamente válido para centrarla, ¿no?

Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es-es">
<head>
<title>Tabla</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<table width="500" border="1" align="center">
<tr>
<td>un texto</td>
<td>Aquí más texto</td>
<td>y un poco más</td>
</tr>
</table>
</body>
</html>
__________________
Visita mi nueva web idplus.org