Ver Mensaje Individual
  #19 (permalink)  
Antiguo 09/08/2010, 07:45
furoya
(Desactivado)
 
Fecha de Ingreso: noviembre-2002
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 2.367
Antigüedad: 21 años, 5 meses
Puntos: 317
Respuesta: texto que sobrepasa div

Ahora está un poquito más claro.
Y es cierto, en los div funciona ya en navegadores nuevos, pero veo que había hacks para los anteriores, además de CSS en distintas versiones. Creo que de eso hablaba kseso?.

Lo del pre me extrañó bastante. Supuse que era un truco para forzar al texto a que se quedase dentro de la celda, porque allí hay elementos anidados por necesidad y los problemas de tamaño y ajustes son graves. Pero estuve haciendo un par de pruebas, y si no uso unidades de ancho relativas la tabla se ajusta bien a la celda (que sí debe tener una medida). Dejo un ejemplo que usé para esas pruebas.

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<title>WRAPPING.</title>

<style type="text/css">

.principal{
border: 2px black solid;
background-color: silver;
width: 500px;
float: left;

white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP */
word-wrap: break-word; /* IE 5+ */
}

</style>
</head>
<body>
<table style="margin-bottom: 20px; float: left; background: red;">
<tbody style="background: green;">
<tr style="background: blue;">
<td class="principal">
ggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwwwggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwwwggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwwwggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwww
</td>
</tr>
</tbody>
</table>

<table style="background: red; clear: both;">
<tbody style="background: green;">
<tr style="background: blue;">
<td class="principal">
ggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwwwggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwwwggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwwwggggggggggggggggggggggggkkkkkkkkkkkkkkkkkkkkwwwwwwwwwwwwww
</td>
</tr>
</tbody>
</table>
</body>
</html>
Si aparecen espacios en el texto de relleno, los borran.

Ahora pienso que ese pre está para versiones más antiguas. En fin, la única recomendación es cambiarle la fuente, para que no aparezca por default una monospace.

Gracias, emprear.

Ancho celda tabla fijo

Textarea sin scrollbars