Foros del Web » Programando para Internet » PHP »

Texto que no se adapta a una tabla o DIV

Estas en el tema de Texto que no se adapta a una tabla o DIV en el foro de PHP en Foros del Web. Hola a todos, Bueno les explico un pequeño problema que tengo haber si alguien tiene una solucion ;). Tengo una tabla HTML con un tamaño ...
  #1 (permalink)  
Antiguo 01/05/2011, 07:38
 
Fecha de Ingreso: mayo-2011
Mensajes: 2
Antigüedad: 13 años
Puntos: 0
Pregunta Texto que no se adapta a una tabla o DIV

Hola a todos,

Bueno les explico un pequeño problema que tengo haber si alguien tiene una solucion ;).
Tengo una tabla HTML con un tamaño especificado en PX pero resulta que en un campo donde tengo texto, en este caso que pondre simplemente tengo una repiticion de 4's pero no se adapta al tamaño de la tabla. Si alguien tiene una idea de porque no funciona se lo agradeceria mucho:

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Shitges</title>
</head>

<body>
<table width='594px' border='1px'>
<tr>
<td><img src='http://127.0.0.1:8888/shitges/images/imagenes_news/imagenNoticia5.jpg' width='200px' height='215px'></td>
<td style='max-width:394px'; height='188px' style='vertical-align:top;'>PRUEBA<br>Posteado por dani el 2011-04-21<hr><p>444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444</p><td rowspan="1" width='5px' style='vertical-align:top;'>A</td></td>
</tr>
<tr><td colspan="3" align='right'>LEER MÁS</td></tr>
</table>
</body>
</html> 
Tambien quiero poner otro ejemplo pero en este caso a base de CSS y PHP, muchas gracias.

Código:
body {
	margin:0 0 0 0px;
	text-align:center;
    background-color:#ffffff;
}

#contenedor {
	text-align:left;
	width:924px;
	height:auto;
	margin:auto;
	padding-top:75px;
}

#cabecera {
	position:relative;
	width:924px;
	height:200px;
}

#cabeceraEntera {
	position:relative;
	width:924px;
	height:200px;
	background-image:url('./images/cabecera.png')
}

#buscadorCabeceraRight {
	width:440px;
	height:17px;
	position:absolute;
	right:185px;
	top:33px;
}

#tablaUsuario {
	width:150px;
	height:120px;
	position:absolute;
	right:135px;
	top:67px;
}

/*Cuerpo de la noticia: noticia, imagen noticia, noticia y indexacion*/
#cuerpo {
    margin:0px;
	background-image:url('./images/Dibujo.png')
}

#noticia {
	position:relative;
	width:924px;
	height:255px;
	background-image:url('./images/Dibujo1.png')
}

#imagenNoticia {
	position:relative;
	float:left; 
	left:160px;
	top:20px;
}

#imagenNoticia.table, td {
	width:200px;
	height:215px;
}

/*Tamaño predeterminado para la imagen/video de la noticia*/
div.img img {
	width:200px;
	height:215px;
}

object {
	position:relative;
	top:-5px;
	max-width:275px;
	max-height:185px;
}

embed {
	position:relative;
	top:-5px;
	max-width:275px;
	max-height:185px;
}

iframe {
	position:relative;
	top:-5px;
	max-width:275px;
	max-height:185px;
}

#cuerpoNoticiaImagen {
	position:relative;
	top:20px;
	right:-150px;
	float:right;
	background-color:green;
}

#cuerpoNoticiaImagen.table, td {
	width:394px;
	height:188px;
}

#cuerpoNoticiaVideo {
	position:relative;
	top:20px;
	right:150px;
	width:320px;
	height:180px;
	float:right;
	background-color:green;
}

#numeroComentOVisits {
	position:absolute;
	text-align:center;
	padding-top:5px;
	right:5px;
	top:8px;
	width:35px;
	height:25px;
	background-color:red;
}

#leerMasImagen {
	position:absolute;
	text-align:center;
	padding-top:3px;
	left:674px;
	top:208px;
	width:100px;
	height:25px;
	background-color:yellow;
}

#leerMasVideo {
	position:absolute;
	text-align:center;
	padding-top:3px;
	left:674px;
	top:200px;
	width:100px;
	height:25px;
	background-color:yellow;
}

/*Numero de páginas*/
#indexacionNoticias {
	width:924px;
	height:262px;
	background-image:url('./images/arriba3.png')
}

#numeroIndexacion {
	position:relative;
	top:16px;
	left:227px;
	width:500px;
	height:50px;
	background-color:maroon;
}

/*Fin de noticia*/

#piedePagina {
	clear:both;
    width:924px;
	height:262px;
	background-image:url('./images/arriba4.png')
}

#piedePaginaCuerpo {
	position:relative;
	left:262px;
	top:15px;
	width:400px;
	height:50px;
	background-color:blue;
}
Y aqui el apartado correspondiente al CSS:

Código PHP:
    <div id="cuerpo">
            <?php
            $seleccionar_noticias
="select id_noticia, titulo_noticia, creador_noticia, imagen_noticia, video_noticia, corta_noticia, fecha_noticia from noticias order by id_noticia desc";
            
$result=mysql_query($seleccionar_noticias);

            while (
$info_noticias=mysql_fetch_array($result)) {
            
$id_noticia=$info_noticias['id_noticia'];
            
$titulo_noticia=$info_noticias['titulo_noticia'];
            
$creador_noticia=$info_noticias['creador_noticia'];
            
$imagen_noticia=$info_noticias['imagen_noticia'];
            
$video_noticia=$info_noticias['video_noticia'];
            
$corta_noticia=$info_noticias['corta_noticia'];
            
$fecha_noticia=$info_noticias['fecha_noticia'];
            
            if(empty(
$video_noticia)) {
            echo 
"<div id='noticia'><table width='394px'>";
                echo 
"<tr>";
                echo 
"<td><div id='imagenNoticia' class='img'><img src='$imagen_noticia'></div></td>";
                echo 
"<td><div id='cuerpoNoticiaImagen'>$titulo_noticia<br>Posteado por $creador_noticia el $fecha_noticia<hr><p>$corta_noticia</p></div></td>";
                echo 
"</tr>";
                echo 
"<div id='leerMasImagen'>LEER MÁS</div>";
            echo 
"</table></div>";
            }
            elseif(empty(
$imagen_noticia)) {
            echo 
"<div id='noticia'>";
                echo 
"<div id='imagenNoticia'>$video_noticia</div>";
                echo 
"<div id='cuerpoNoticiaVideo'>$titulo_noticia<br>Posteado por $creador_noticia el $fecha_noticia<div id='numeroComentOVisits'>11</div><hr><p>$corta_noticia</p></div>";
                echo 
"<div id='leerMasVideo'>LEER MÁS</div>";
            echo 
"</div>";
            }
            elseif(empty(
$imagen_noticia) and ($video_noticia==NULL)) {
            echo 
"Error en la imagen o video de la noticia";
            }}
            echo 
"<img src='./images/Dibujo2.png'>";
            
?>
            <div id="indexacionNoticias">
                <div id="numeroIndexacion"></div>
            </div>
Si resulta que alguien tiene una idea y me diria si seria mas aconsejable utilizar los DIV's para en este caso un cajon de una noticia o la tabla se lo agradeceria mucho la recomendacion ;)

Última edición por danitree; 01/05/2011 a las 07:40 Razón: Correcion de titulo
  #2 (permalink)  
Antiguo 01/05/2011, 08:44
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: Texto que no se adapta a una tabla o DIV

Si te refieres a que el texto se sale de la tabla eso se debe a que lo que has puesto es una palabra entera y por eso no se baja hacia abajo.

Si te refieres a que no se hace más grande es porque le has limitado tu el tamaño en el html mediante max-width.
  #3 (permalink)  
Antiguo 01/05/2011, 09:29
 
Fecha de Ingreso: mayo-2011
Mensajes: 2
Antigüedad: 13 años
Puntos: 0
Respuesta: Texto que no se adapta a una tabla o DIV

Hola Alex,

Pues al parecer almenos con la tabla era la palabra, muchas gracias. No he probado con lo de los DIV's pero creo qeu esa daba error igualmente muchas gracias.

Si tengo otra duda espero que no te moleste que te envie un privado. Gracias.

Etiquetas: tabla
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 12:21.