Jump to content
MakeWebGames

Table help


SHAD

Recommended Posts

I use a simple solution but im sure there are different ways

 

  echo '
		<table cellpadding="1" cellspacing="1" width="75%" border="0">
<tr>
	<th>Numbers</th>
</tr>
  ';
$cblah = 1;
while( $cblah <= 10 ) {
$colory = ( $cblah % 2 ) ? '#ABABAB' : '#B0B0B0';
  echo '
<tr style="background-color: '.$colory.'; color: #000000; font-weight: BOLD;">
	<td>'.$cblah.'</td>
</tr>
  ';

$cblah++;
}
  echo '
		</table>
  ';

Hope this helps (didn't test this).

Link to comment
Share on other sites

Look into CSS's :nth-child element :)

Unfortunatly there is no support for it within IE (might of known)

Which then is fixable using Javascript (Jquery too)

But that then leaves the 1% of IE users that are paranoid and have Javascript turned off where it will not work but generally no-one bothers about them so yeah..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...