advanced css- php question

Discussion in 'CSS' started by erkanbs, Jul 24, 2011.

  1. #1
    hey all,

    i want to do same thing with links at left frame. http://goo.gl/4XMG9 here is the example. im using php and want to make links diffirent than before it.

    at the left frame a link is grey and next one is darker grey. thats the main problem for me how can i do it in css and php?

    thanks for the answers :)
     
    erkanbs, Jul 24, 2011 IP
  2. Cucumba123

    Cucumba123 Well-Known Member

    Messages:
    1,403
    Likes Received:
    34
    Best Answers:
    3
    Trophy Points:
    150
    #2
    Cucumba123, Jul 24, 2011 IP
  3. Darkhodge

    Darkhodge Well-Known Member

    Messages:
    2,111
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    185
    #3
    Alternatively a PHP & CSS solution would be to:

    • Set the default link to be light grey.
    • Within the loop, determine if the counter/index is odd or even using %, i.e. modulus.
    • If it's even, assign a class to the link which sets the colour to dark grey.

    Just for clarification your CSS could be something like:

    
    a{
    display: block;
    background: #ccc;
    }
    a.darkGrey{
    background: #aaa;
    }
    
    Code (markup):
    This is a very broad CSS rule so you'd want to limit it more.

    Also to check for odd/even in PHP:

    
    // Loop for example
    for($i = 0; $i < 10; $i++){
    
    if ($i % 2) print "$i is odd.<br />";
    else print "$i is even.<br />";
    
    }
    
    Code (markup):
    Hope that helps you start in the right direction :)
     
    Darkhodge, Aug 1, 2011 IP
  4. Toycel

    Toycel Peon

    Messages:
    243
    Likes Received:
    11
    Best Answers:
    4
    Trophy Points:
    0
    #4
    Toycel, Aug 7, 2011 IP
  5. cy99dasilva

    cy99dasilva Member

    Messages:
    158
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #5
    cy99dasilva, Aug 15, 2011 IP