Jump to content


Alternating Table Rows: Look great in Firefox, flawed in IE

  • Please log in to reply
4 replies to this topic

#1 ridiculous

  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 07 October 2006 - 06:14 AM

Here's my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<style type="text/css">
body {
	font-size: 12px;
	font-family: arial, helvetica, sans-serif;
	color: #333;

#trentdiv {
	top: 50%;
	left: 50%;
	margin-top: -150px; /*set to a negative number 1/2 of your height*/
	margin-left: -255px; /*set to a negative number 1/2 of your width*/
	border: 5px solid #ccc;
	background-color: #f3f3f3;


// Connects to your Database 
mysql_connect("", "", "") or die(mysql_error()); 
mysql_select_db("") or die(mysql_error()); 

$jobs = mysql_query("SELECT date, title, location FROM jobs
ORDER BY `postid` DESC LIMIT 0 , 30") 
or die (mysql_error());

$numofrows = mysql_num_rows($jobs);

echo "<div id='trentdiv'>";
echo "<table width='500 px' height= '400 px' align = 'center' border='1' cellpadding='3' cellspacing='3'> </tr>";

for($i = 0; $i < $numofrows; $i++) {
    $row = mysql_fetch_array($jobs); //get a row from our result set
    if($i % 2) { //this means if there is a remainder
	echo "<tr bgcolor='#ddd8dc'";
	} else { 
	echo "<tr bgcolor='#feaae9'>";
	echo 	"
			<td align=left> 	".$row['date']."		</td>
			<td align=center><b>".$row['title']."	</b>	</td>
			<td align=center>	".$row['location']."	</td>";
    echo "</tr>";

echo "</TABLE>";
echo "</div>";


Any insight would be muchly appreciated, here's a couple of jpegs that demonstrate what I'm talking about...

Posted Image

Posted Image

#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 October 2006 - 03:38 PM

I can't see anything... could you describe the problem is more details?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 anatak

  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 19 October 2006 - 06:31 AM

echo "<tr bgcolor='#ddd8dc'";

close your <tr> tag maybe that will help

echo "<tr bgcolor='#ddd8dc'>";

kind regards


#4 Daniel0

  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 19 October 2006 - 06:58 AM

anatak: He can't use the bgcolor attribute as he is using XHTML 1.0 Strict.

#5 anatak

  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 19 October 2006 - 07:15 AM

daniel0: you are right
should be css
but I thought that not closing the tag might be why it does not show in ie but works in firefox.

I think that even if you declare it strict it will work with all the mistakes  (i honestly can not believe that all websites there are have no errors in them ;) )
If you validate it you will get the errors.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users