CSS and Tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This question is a little OT but no doubt everyone and their brother is
generating tables here so heres my question.

I'm a little frustrated with CSS. Sure I can define styles for TH, TD,
and so on. But mildly sophisticated pages are buried in tables within
tables. Specifying global styles for these tags is useless. Likewise I
can define a class like:

.t { 
    font-size: small;
    border-bottom: 1px lightgrey solid;
    border-right: 1px lightgrey solid;
}

and add a class="t" to EVER SINGLE TH and TD tag like:

  echo "<table cellpadding=\"0\" cellspacing=\"0\">";
  echo "<tr><td class=\"t\">ID</td><td class=\"t\">Username</td><td class=\"t\">Name</td><td class=\"t\">Email</td><td class=\"t\">Options</td><td class=\"t\">Date</td>";
  while ($row = mysql_fetch_row($result)) {
      echo "<tr><td class=\"t\">$row[0]</td> <td class=\"t\">$row[1]</td> <td class=\"t\">$row[2]</td> <td class=\"t\">$row[5]</td> <td class=\"t\">$row[6]</td> <td class=\"t\">$row[7]</td> <tr/>";
  }       
  echo "</table>";

but that is a total waste of bandwidth and typing. Also, it's just ugly.

What I *want* to do is define a class for TR or TABLE or better still
just add a DIV around the entire section I want to style and have it
affect the encosed region. What does the "cascade" in CSS stand for?

So can anyone recommend a method to this maddness?

Thanks,
Mike

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux