Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/05/2013, 14:29
pilucho
 
Fecha de Ingreso: noviembre-2004
Ubicación: NULL
Mensajes: 655
Antigüedad: 21 años, 10 meses
Puntos: 6
Respuesta: Alternar Color en DIV

Si funcionan pero hay un detalle si quiero mostrar solo 3 colores fijos, intente usar con SQL y funcionan


Cita:
Iniciado por bulter Ver Mensaje
Código PHP:
<?php
    $color 
= "";
    
$limit = 10;

    for(
$i = 0; $i <= $limit; $i++)
    {
        if((
$i % 2) == 0)
        {
            
$color = "#fff";
        }
        else
        {
            
$color = "#ccc";
        }

        echo 
"<div class='barra-color' style='background-color: " . $color . ";'>textos</div>";
    }    
?>
Prueba aber asi. Cambia el valor de $limit