Foros del Web » Creando para Internet » CSS »

Problema con una Tabla (IE vs FF)

Estas en el tema de Problema con una Tabla (IE vs FF) en el foro de CSS en Foros del Web. Que tal, me presento con una duda que me tiene mas que harto . Estoy haciendo un layout con unas tablas, quiero que sea 100% ...
  #1 (permalink)  
Antiguo 23/02/2007, 13:10
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Problema con una Tabla (IE vs FF)

Que tal, me presento con una duda que me tiene mas que harto .

Estoy haciendo un layout con unas tablas, quiero que sea 100% valido, y ya lo logre, en Firefox se ve mas que perfecto, pero en InternetExplorer se ve demasiado mal, adjunto el codigo:
Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Kern Liebers</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<style type="text/css">
		html, body {
			border: 0px;
			width: 100%;
			margin: 0px;
			height: 100%;
		}
		body {
			background-color: #ffffff;
			color: #000000;
			font-family: Arial, Helvetica, sans-serif;
		}
		#table_main {
			width: 100%;
			height: 100%;
		}
		#top_menu {
			padding: 0px;
			margin: 0px;
			display: inline;
		}
		#top_menu li {
			display: inline;
			list-style: none;
			padding: 0px;
			padding-right: 5px;
		}
		#top_menu a, #top_menu a:visited {
			color: white;
			text-decoration: none;
			font-size: 12px;
		}
		#top_menu a:hover {
			color: black;
		}
		.active {
			background: #99CC99;
		}
		#main_cell {
			background: #CCFFCC;
			padding: 10px;
		}
		#menu_lateral {
			list-style: none;
			padding: 0px;
		}
		#menu_lateral a, #menu_lateral a:visited {
			color: white;
			text-decoration: none;
			padding-left: 20px;
			font-size: 11px;
		}
		#menu_lateral a:hover {
			color: black;
		}
		.titulito {
			text-align: center;
			margin: 0px;
			font-size: 11px;
		}
		</style>
	</head>

<body>
<table id="table_main" cellspacing="0" cellpadding="0">
	<tbody>
		<tr>
			<td height="28" width="153" style="background: url('gris.jpg'); height: 28px;">&nbsp;</td>
			<td style="background: #999999">&nbsp;</td>
		</tr>
		<tr>
			<td height="19" style="background: url('gris2.jpg');">&nbsp;</td>
			<td valign="middle" style="background: #4F4F50;">
				<img src="aktiv.gif" alt="Bullet" width="9" height="9">
				<ul id="top_menu">
					<li><a href="http://www.reforma.com">Espa&ntilde;ol</a> </li>
					<li><a href="/htmen/index.htm" target="_self">English</a> </li>
					<li><a href="http://www.reforma.com">&nbsp;Imprimir</a></li>
					<li><a href="/htm/mapadelsitio.htm" target="_self">Mapa del Sitio</a></li>
					<li><a href="/htm/general.htm" target="_self">General</a></li>
					<li><a href="/htm/tradeterms.htm" target="_self">Trade Terms</a></li>
				</ul>
			</td>
		</tr>
		<tr>
			<td height="51" width="153" rowspan="2">
				<img src="logo_prometall.jpg" width="153" height="51" alt="Prometall"></td>
			<td height="3" style="background: #CACACC;"></td>
		</tr>
		<tr> 
			<td height="47" style="background: #4EA91D;">
				<img src="motivbild.jpg" width="587" height="47" alt="Piezas"></td>
		</tr>
		<tr>
			<td style="background-color: #999999;" valign="top">
				<p class="titulito">Grupo Kern-Liebers</p>
				<ul id="menu_lateral">
					<li class="active"><a href="http://www.reforma.com">Home</a></li>
					<li><a href="/htm/productos.htm" target="_self">Productos</a></li>
					<li><a href="/htm/compania.htm" target="_self">Compa&ntilde;&iacute;a</a></li>
					<li><a href="/htm/contacto.htm" target="_self">Contacto</a></li>
					<li><a href="http://www.kern-liebers.de/" target="_blank">KERN-LIEBERS</a></li>
				</ul>
			</td>
			<td id="main_cell" valign="top">
				<h1>AQUI VA TODO EL CONTENIDO</h1>
			</td>
		</tr>
	</tbody>
</table>
</body>
</html>
Y esto es lo que se ve en cada explorador:
Firefox:

Internet Explorer:


Espero algun mago en CSS me pueda ayudar
Gracias de antemano.
  #2 (permalink)  
Antiguo 23/02/2007, 16:07
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Re: Problema con una Tabla (IE vs FF)

mmmm quitando el Doctype se arregla en IE y Firefox, jeje, cosas raras, aunque no me gusta porque ya deja de ser valido el codigo...
  #3 (permalink)  
Antiguo 23/02/2007, 17:38
Avatar de Mikmoro
Colaborador
 
Fecha de Ingreso: octubre-2006
Ubicación: K-pax
Mensajes: 7.228
Antigüedad: 17 años, 6 meses
Puntos: 280
Re: Problema con una Tabla (IE vs FF)

Puedes probar con este código:

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<hea>
<title>Kern Liebers</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
html, body {
border: 0px;
width: 100%;
margin: 0px;
height: 100%;
}
body {
background-color: #ffffff;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
}
#table_main {
width: 100%;
height: 100%;}
#top_menu {
padding: 0px;
margin: 0px;
display: inline;
}
#top_menu li {
display: inline;
list-style: none;
padding: 0px;
padding-right: 5px;
}
#top_menu a, #top_menu a:visited {
color: white;
text-decoration: none;
font-size: 12px;
}
#top_menu a:hover {
color: black;
}
.active {
background: #99CC99;
}
#main_cell {
background: #CCFFCC;
padding: 10px;
height: 82%;
}
#menu_lateral {
list-style: none;
padding: 0px;
margin-left: 0px;
}
#menu_lateral a, #menu_lateral a:visited {
color: white;
text-decoration: none;
padding-left: 20px;
font-size: 11px;
}
#menu_lateral a:hover {
color: black;
}
.titulito {
text-align: center;
margin: 0px;
font-size: 11px;
}
</style>
</head>
<body>
<table id="table_main" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td height="6%" width="153" style="background: url('gris.jpg'); height: 28px;">&nbsp;</td>
<td style="background: #999999">&nbsp;</td>
</tr>
<tr>
<td height="3%" style="background: url('gris2.jpg');">&nbsp;</td>
<td valign="middle" style="background: #4F4F50;">
<img src="aktiv.gif" alt="Bullet" width="9" height="9">
<ul id="top_menu">
<li><a href="http://www.reforma.com">Espa&ntilde;ol</a> </li>
<li><a href="/htmen/index.htm" target="_self">English</a> </li>
<li><a href="http://www.reforma.com">&nbsp;Imprimir</a></li>
<li><a href="/htm/mapadelsitio.htm" target="_self">Mapa del Sitio</a></li>
<li><a href="/htm/general.htm" target="_self">General</a></li>
<li><a href="/htm/tradeterms.htm" target="_self">Trade Terms</a></li>
</ul>
</td>
</tr>
<tr>
<td height="9%" width="153" rowspan="2">
<img src="logo_prometall.jpg" width="153" height="51" alt="Prometall"></td>
<td height="3" style="background: #CACACC;"></td>
</tr>
<tr> 
<td height="47" style="background: #4EA91D;">
<img src="motivbild.jpg" width="587" height="47" alt="Piezas"></td>
</tr>
<tr>
<td style="background-color: #999999;" valign="top" align="left">
<p class="titulito">Grupo Kern-Liebers</p>
<ul id="menu_lateral">
<li class="active"><a href="http://www.reforma.com">Home</a></li>
<li><a href="/htm/productos.htm" target="_self">Productos</a></li>
<li><a href="/htm/compania.htm" target="_self">Compa&ntilde;&iacute;a</a></li>
<li><a href="/htm/contacto.htm" target="_self">Contacto</a></li>
<li><a href="http://www.kern-liebers.de/" target="_blank">KERN-LIEBERS</a></li>
</ul>
</td>
<td id="main_cell" valign="top">
<h1>AQUI VA TODO EL CONTENIDO</h1>
</td>
</tr>
</tbody>
</table>
</body>
</html>
De todos modos, como te dirán otros enseguida (aupa, Kahlito ), aunque tu página sea válida se va a saltar muchas cosas de accesibilidad: está diseñada sobre tablas, hay estilos en las propias etiquetas, etc.

Mikel.
  #4 (permalink)  
Antiguo 26/02/2007, 15:31
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Re: Problema con una Tabla (IE vs FF)

Muchas gracias mikmoro, me podrias decir que era lo que estaba mal?

Gracias.
  #5 (permalink)  
Antiguo 26/02/2007, 15:58
Avatar de B**
B**
 
Fecha de Ingreso: enero-2006
Ubicación: Monterrey,Mexico
Mensajes: 952
Antigüedad: 18 años, 3 meses
Puntos: 3
Re: Problema con una Tabla (IE vs FF)

GatorV si quieres que te valide correctamente... deberias de usar divs y posicionar tu informacion... es mucho mas semantico.
__________________
-URL= Go PHP5.
-Age=22.
-Learning=PHP,J2EE,Struts,MAMBO,C++,JSON,AJAX,XHTML ,CSS.
  #6 (permalink)  
Antiguo 26/02/2007, 16:14
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Re: Problema con una Tabla (IE vs FF)

Se que es mas semantico pero usando Divs o Tablas para un layout no le hace menos al validador, me importa que se vea como tiene que ser. Aparte que no se bien hacerlo en divs, y fue un layout rapido, jejeje

Pero gracias por el tip
  #7 (permalink)  
Antiguo 26/02/2007, 16:43
Avatar de Mikmoro
Colaborador
 
Fecha de Ingreso: octubre-2006
Ubicación: K-pax
Mensajes: 7.228
Antigüedad: 17 años, 6 meses
Puntos: 280
Re: Problema con una Tabla (IE vs FF)

Pues mira, basta con poner el código que tenías al lado del que yo te he puesto y ver las diferencias, que te señalo en negrita.

El problema básicamente es que explorer tiene problemillas (otro más) con los height de las tablas. Si tú marcas el alto de una celda en pixels, cuando la tabla va creciendo por el contenido, IE se empieza a pasar por el forro el tamaño de alto que has puesto a tus celdas, mientras que si lo pones en porcentajes, lo respeta mejor.
Una de las cosas más importantes es que a la celda central, la del contenido (main_cell), no le habías puesto ningún alto, y entonces al crecer la tabla hace crecer cada celda de forma proporcional. Si le das un alto en porcentaje a esa celda, siempre ocupa más o menos ese porcentaje del total, y entonces es más fácil que respete el resto de celdas.

El menú lateral tenía un problema con el margen, que al no tener ninguno, IE le pone el que tiene por defecto para esa etiqueta, por lo que forzándolo a 0px se va a su sitio.

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<hea>
<title>Kern Liebers</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
html, body {
border: 0px;
width: 100%;
margin: 0px;
height: 100%;
}
body {
background-color: #ffffff;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
}
#table_main {
width: 100%;
height: 100%;}

#top_menu {
padding: 0px;
margin: 0px;
display: inline;
}
#top_menu li {
display: inline;
list-style: none;
padding: 0px;
padding-right: 5px;
}
#top_menu a, #top_menu a:visited {
color: white;
text-decoration: none;
font-size: 12px;
}
#top_menu a:hover {
color: black;
}
.active {
background: #99CC99;
}
#main_cell {
background: #CCFFCC;
padding: 10px;
height: 82%;
}
#menu_lateral {
list-style: none;
padding: 0px;
margin-left: 0px;
}
#menu_lateral a, #menu_lateral a:visited {
color: white;
text-decoration: none;
padding-left: 20px;
font-size: 11px;
}
#menu_lateral a:hover {
color: black;
}
.titulito {
text-align: center;
margin: 0px;
font-size: 11px;
}
</style>
</head>
<body>
<table id="table_main" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td height="6%" width="153" style="background: url('gris.jpg'); height: 28px;">&nbsp;</td>
<td style="background: #999999">&nbsp;</td>
</tr>
<tr>
<td height="3%" style="background: url('gris2.jpg');">&nbsp;</td>
<td valign="middle" style="background: #4F4F50;">
<img src="aktiv.gif" alt="Bullet" width="9" height="9">
<ul id="top_menu">
<li><a href="http://www.reforma.com">Espa&ntilde;ol</a> </li>
<li><a href="/htmen/index.htm" target="_self">English</a> </li>
<li><a href="http://www.reforma.com">&nbsp;Imprimir</a></li>
<li><a href="/htm/mapadelsitio.htm" target="_self">Mapa del Sitio</a></li>
<li><a href="/htm/general.htm" target="_self">General</a></li>
<li><a href="/htm/tradeterms.htm" target="_self">Trade Terms</a></li>
</ul>
</td>
</tr>
<tr>
<td height="9%" width="153" rowspan="2">
<img src="logo_prometall.jpg" width="153" height="51" alt="Prometall"></td>
<td height="3" style="background: #CACACC;"></td>
</tr>
<tr> 
<td height="47" style="background: #4EA91D;">
<img src="motivbild.jpg" width="587" height="47" alt="Piezas"></td>
</tr>
<tr>
<td style="background-color: #999999;" valign="top" align="left">
<p class="titulito">Grupo Kern-Liebers</p>
<ul id="menu_lateral">
<li class="active"><a href="http://www.reforma.com">Home</a></li>
<li><a href="/htm/productos.htm" target="_self">Productos</a></li>
<li><a href="/htm/compania.htm" target="_self">Compa&ntilde;&iacute;a</a></li>
<li><a href="/htm/contacto.htm" target="_self">Contacto</a></li>
<li><a href="http://www.kern-liebers.de/" target="_blank">KERN-LIEBERS</a></li>
</ul>
</td>
<td id="main_cell" valign="top">
<h1>AQUI VA TODO EL CONTENIDO</h1>
</td>
</tr>
</tbody>
</table>
</body>
</html>
Estoy de acuerdo con B** en que deberías diseñar esto sin tablas, porque a decir verdad tampoco te resultan imprescindibles en este caso, pero no dije nada por no parecer pesado (ni un talibán de css)

Mikel.
  #8 (permalink)  
Antiguo 26/02/2007, 21:29
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Re: Problema con una Tabla (IE vs FF)

jaja ok, muchas gracias , no conoces algun tutorial bueno para aprender a no programar con tablas y empezar a programar como debo de?

Muchas Gracias! Saludos!

Última edición por GatorV; 26/02/2007 a las 21:36
  #9 (permalink)  
Antiguo 27/02/2007, 02:47
Avatar de Mikmoro
Colaborador
 
Fecha de Ingreso: octubre-2006
Ubicación: K-pax
Mensajes: 7.228
Antigüedad: 17 años, 6 meses
Puntos: 280
Re: Problema con una Tabla (IE vs FF)

En este hilo están hablando precisamente de eso:

http://www.forosdelweb.com/f53/tutoriales-sencillos-css-467242/

Mikel.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:29.