I have the following code. I have two background images for buttons - "lightSquare.jpg" and "darkSquare.jpg". Currently, all buttons have the background image called "darkSquare.jpg". What I want to do is have alternate buttons have light and dark images, like a chessboard. How could that be done?
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>The Main Page</title>
</head>
<body>
<table>
<tr>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
</tr>
<tr>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
<td><button></button></td>
</tr>
</table>
</body>
</html>
The CSS is as follows -
button
{
background-image:url('darkSquare.jpg');
width:50px;
height:50px;
border: 0
}
table
{
border-collapse: collapse;
}
td { padding:0; }