Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2009
    Location
    Western Australia
    Posts
    386
    Tokens
    0

    Default While() CSS Styling

    I've noticed this for a while but is there a reason why CSS styles don't work in while(); loops.

  2. #2
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    CSS are rules for how things should look on a page.

    It is not a scripting language such as Javascript, so does not feature while / for statements.

  3. #3
    Join Date
    Mar 2009
    Location
    Western Australia
    Posts
    386
    Tokens
    0

    Default

    Sorry, I should of been more clear, I'm doing outputting data from a mysql_query using mysql_fetch_assoc(); but when I use a while loop the font-size returns to it's default size and font-family.

  4. #4
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    There shouldn't be any styling issues caused by using any loop in PHP. I assume the issue is caused because the data you are outputting is presented in a table, which tend to ignore some parent CSS rules.

    Try adding ",td,th" to the end of your CSS selector which determines text size, eg:

    Code:
    body {
    font-size:12px;
    }
    becomes:
    Code:
    body,td,th {
    font-size:12px;
    }
    Of course, any other properties in that original selector would then apply to each table cell, so you'll probably want to set the font-size property by itself.
    Last edited by Apolva; 17-08-2011 at 03:06 PM.

  5. #5
    Join Date
    Mar 2009
    Location
    Western Australia
    Posts
    386
    Tokens
    0

    Default

    ^ I tried that but I'll try again after school, it is in face inside a table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •