Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/12/2008, 10:49
aortiz_endirecto
 
Fecha de Ingreso: octubre-2005
Mensajes: 19
Antigüedad: 18 años, 5 meses
Puntos: 0
TD que salten de línea

Buenas tardes,

La cuestión que me invade es que tengo un div con una tabla de una fila y n columnas. El ancho del div es 500px y con n filas al poner texto en cada columna no me respeta el ancho del div contenedor y se sigue ensanchando.

A mi gustaría que al llegar al ancho del div los td se comportaran como elementos en línea y saltaran a la línea siguiente.


¿Esto se puede hacer con la propiedad display:inline aplicada a los td de la tabla??

Éste es el código

CSS:

Código:
<style type="text/css">
.contenedor {width:500px;background:#CCCCCC;}
table.prueba td{display:inline;background:yellow;}
</style>
HTML:
Código:
<div class="contenedor">
	<table class="prueba">
		<tr>
			<td >asdfjkñadjsfhañdkfjhañd</td>
			<td >asdfjkñadjsfhañdkfjhañd</td>
			<td >asdfjkñadjsfhañdkfjhañd</td>
			<td >asdfjkñadjsfhañdkfjhañd</td>
			<td >asdfjkñadjsfhañdkfjhañd</td>
			<td >asdfjkñadjsfhañdkfjhañd</td>
			<td >asdfjkñadjsfhañdkfjhañd</td>
			<td >asdfjkñadjsfhañdkfjhañd</td>
		</tr>
	</table>
</div>
Muchas gracias y un saludo a todos ;)