Foros del Web » Creando para Internet » CSS »

[SOLUCIONADO] Redimensionar div automaticamente

Estas en el tema de Redimensionar div automaticamente en el foro de CSS en Foros del Web. Buenas, estoy desarrollando un slide de imagenes horizontal y el problema que tengo es que no se como podría hacer dinámico el width del segundo ...
  #1 (permalink)  
Antiguo 05/03/2014, 04:21
 
Fecha de Ingreso: abril-2009
Mensajes: 63
Antigüedad: 15 años
Puntos: 0
Redimensionar div automaticamente

Buenas, estoy desarrollando un slide de imagenes horizontal y el problema que tengo es que no se como podría hacer dinámico el width del segundo div, actualmente lo tengo puesto a 2000 pixeles y al final le sobra un poco y en otros casos tengo varias imagenes y si se queda corto por lo que realiza un salto de línea.

Este es el código:

Código HTML:
<div style="width:300px; background-color:white; height:180px; overflow:auto;">
    <div style="width: 2000px; height: 180px;background-color:silver">
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
        <image width="auto" height="170px" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/>
    </div>
</div> 
¿Hay alguna manera de que el width del segundo div sea dinamico?

Saludos
  #2 (permalink)  
Antiguo 05/03/2014, 06:06
 
Fecha de Ingreso: abril-2009
Mensajes: 63
Antigüedad: 15 años
Puntos: 0
Respuesta: Redimensionar div automaticamente

Buenas, al final he encontrado una forma de hacerlo, este es el código

Código HTML:
<div id="container">
    <ul id="list">
        <li><img height="240px" widht="auto" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/></li>
        <li><img height="240px" widht="auto" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/></li>
        <li><img height="240px" widht="auto" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/></li>
        <li><img height="240px" widht="auto" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/></li>
        <li><img height="240px" widht="auto" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/></li>
        <li><img height="240px" widht="auto" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/></li>
        <li><img height="240px" widht="auto" src="https://lh6.ggpht.com/DTkTSeycCBedLKFEDdFf3n_uPxz2uv3JeZPj7Vzd5imFRIYBrtUNUQ8HRJaeY9L6JeB5=h310"/></li>
    </ul>
</div>

<style>
    
    
    #container{
        width: 200px;
        overflow-y:hidden;
        overflow-x:scroll;
        white-space:nowrap;
        text-align:center;
    }
#list{
    
    
    
}

#list li{
    display: inline;
    
}


</style> 
Saludos!

Etiquetas: automaticamente, background, color, imagenes, redimensionar
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 10:35.