#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    New Zealand
    Posts
    167
    Rep Power
    14

    CSS - sometimes works, sometimes not... why?


    Hi all,

    I'm no CSS expert but I've never had much trouble with them in IE before! This has really got me stuck.

    The classes are defined in a seperate sheet, like so:

    -- style.css --

    a.cathead {
    font-family : Arial, Helvetica;
    color : #FFFFFF;
    text-decoration : none;
    FONT-SIZE : 12px;
    font-weight: bold;
    }

    a.cathead:hover {
    font-family : Arial, Helvetica;
    color : #FF9900;
    text-decoration : none;
    FONT-SIZE : 12px;
    font-weight: bold;
    }

    a.cathead:visited {
    font-family : Arial, Helvetica;
    color : #FFFFFF;
    text-decoration : none;
    FONT-SIZE : 12px;
    font-weight: bold;
    }

    -- end style.css --

    and are called in index.php

    PHP Code:

    if (in_array($c$threetimes)) //If it's a multiple of 3, then it's on the end of a table row.
    {
    echo 
    "<td width='25%' valign='top'><table width='100%' cellpadding='0' cellspacing='5' border='0'><tr><td bgcolor='$cR' align='center'><p><font face='Arial, Verdana, Helvetica' size='2' color='#FFFFFF'><b><a href='map.php?&sc1=$row[0]&catID=$row[0]' class='cathead'>&nbsp; $row[1]</a></b></font></p></td></tr><tr><td><p><font size='1'>$row[2]</font></p></td></tr></table></td><td width='3%' bgcolor='#FFFFFF'>&nbsp;</td></tr><tr>";
    }
    else
    {
    echo 
    "<td width='25%' valign='top'><table width='100%' cellpadding='0' cellspacing='5' border='0'><tr><td bgcolor='$cR' align='center'><p><font face='Arial, Verdana, Helvetica' size='2' color='#FFFFFF'><b><a href='map.php?&sc1=$row[0]&catID=$row[0]' class='cathead'>&nbsp; $row[1]</a></b></font></p></td></tr><tr><td><p><font size='1'>$row[2]</font></p></td></tr></table></td><td width='3%' bgcolor='#FFFFFF'>&nbsp;</td>"

    anyway, there are 25 records being printed out, into a 3-cell-wide table, so it goes records 1-3, new row, records 4-6, new row etc.

    What is supposed to happen is that the category heading prints out as white 12pt bold, and when a mouseover occurs, the white heading changes to orange. This works SOMETIMES. Records 3,4,6,7 work correctly, as do 8,9 and 12... the ones that don't work just stay white.

    The weird thing is that I know every repitition of that loop is going to print out exactly the same, with the class called the same way, spelt the same way etc.

    So why does it sometimes work and sometimes not? And why do the links that don't mouseover still pick up that they should be white, 12pt bold etc, which is not the default, and yet not process the hover?

    Any ideas? (*help, deadline!*)

    Jen
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    661
    Rep Power
    14
    sometimes happens to me, but refresh seems to fix it here

    Donno why it happens tho?...
  4. #3
  5. Is a Psycho
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    In your computer
    Posts
    231
    Rep Power
    15
    Try putting "FONT-SIZE" as lower case and change the "px" (px = pixel) to "pt" (pt = point), i.e: "font-size: 12pt;" ...

    If I remember correctly CSS is case sensative.

    Give the following PHP code a shot... I replaced the single quotes with double quotes, because some browsers don't like single quotes in HTML.. don't remove the "\" in front of the double quotes.

    PHP Code:
    <?php
    if (in_array($c$threetimes)) //If it\"s a multiple of 3, then it\"s on the end of a table row.
    {
    echo 
    "<td width=\"25%\" valign=\"top\"><table width=\"100%\" cellpadding=\"0\" cellspacing=\"5\" border=\"0\"><tr><td bgcolor=\"$cR\" align=\"center\"><p><b><a href=\"map.php?&sc1=$row[0]&catID=$row[0]\" class=\"cathead\">&nbsp; $row[1]</a></b></p></td></tr><tr><td><p><font size=\"1\">$row[2]</font></p></td></tr></table></td><td width=\"3%\" bgcolor=\"#FFFFFF\">&nbsp;</td></tr><tr>";
    }
    else
    {
    echo 
    "<td width=\"25%\" valign=\"top\"><table width=\"100%\" cellpadding=\"0\" cellspacing=\"5\" border=\"0\"><tr><td bgcolor=\"$cR\" align=\"center\"><p><b><a href=\"map.php?&sc1=$row[0]&catID=$row[0]\" class=\"cathead\">&nbsp; $row[1]</a></b></p></td></tr><tr><td><p><font size=\"1\">$row[2]</font></p></td></tr></table></td><td width=\"3%\" bgcolor=\"#FFFFFF\">&nbsp;</td>"
    }

    ?>
    God Bless
    Scott
    Last edited by deepspring; November 11th, 2001 at 01:52 AM.
    deepspring

    - "Netscape 4 users are like lemmings... You can't help but laugh when one falls off a cliff"
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    New Zealand
    Posts
    167
    Rep Power
    14

    no luck...


    Thanks for your suggestions... unfortunately no joy, but thank you anyway. Guess it's back to the drawing board!

    Cheers,

    Jen

IMN logo majestic logo threadwatch logo seochat tools logo