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

    Join Date
    Jun 2001
    Posts
    12
    Rep Power
    0

    Angry CSS problem (PHP-related?)


    I have a web page, written in PHP, that links to an external cascading style sheet. I have two declarations in my .css file, the second of which is a class:

    BODY { background-color: #000000; }

    .classexample { font-family: Impact; }

    HOWEVER, only the first declaration works on my page!!! Why would the BODY style be imported and work correctly, but the class won't? If I embed the class in the page, it works fine, but it's a no-go from the external sheet.

    I've checked and double-checked my syntax and everything seems okay. The only think I can think of that might be screwing things up is PHP, but I don't know how.

    I'm totally baffled.

    Thanks for any advice you might have. I am using IE 5.5.

    (I guess I could just do a PHP include rather than the traditional HTML LINK tag, but I'm still curious as to why I'm having this problem.)
  2. #2
  3. No Profile Picture
    Divine Wind
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Mongo
    Posts
    24
    Rep Power
    0
    I doubt the problem is either PHP or (as might be more likely) browser related (IE5.5. is OK with this kind of thing). If you could copy and paste the part of the webpage where the CSS class is called then we might be able to see what the problem is. The main problem is usually leaving the full stop/period off the start of the class name i.e.:

    myClass {
    color: red;
    }

    Emps
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    12
    Rep Power
    0
    Ok, here's the CSS code from the external style sheet:

    .storytitle {
    font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
    font-size: 14pt;
    }

    Here's the code I am trying to use to invoke it (note that this code is (a) nested inside a table, and (b) is from a php-included file - either of which may be causing problems):

    print "<SPAN CLASS='storytitle'><A HREF='story.php?storyid=$storyid'>$row[title]</A></SPAN><BR>$row[activated], by $row[username]<BR>";

    Still baffled.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Columbus, OH
    Posts
    11
    Rep Power
    0
    I'm guessing you're trying to make the link use that style. I think you could do this and get rid of the span tags:

    Code:
    <a href="yourlink" class="storytitle">link</a>
    If you're trying to make $row[activited] and/or $row[username] use the storytitle style you just put the </span> tag to early. (I'm guessing you're trying to make the link do it though.)

    If that doesn't work try renaming your style to:
    Code:
    A.storytitle:link{ }
  8. #5
  9. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    12
    Rep Power
    0
    Well, I cut some parts out of my style sheet to see what would happen, and the problem seems to have solved itself. I guess there was something wrong with my sheet, but hell if I know what it was, since the part of the sheet I was actually using remained unchanged.

    I wonder if it will pop up again?

    Thanks for the help.

IMN logo majestic logo threadwatch logo seochat tools logo