<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>国际象棋棋盘</title>
<script>
var str="<table cellpadding='0' cellspacing='0' >";
var odd =true;
for( var i=1; i<9; i++){
str +="<tr>";
for(var j=1; j<9; j++){
if(odd){
odd = !odd;
str += '<td class="td01"></td>';
}else {
odd = !odd;
str +="<td class='td02' ></td>";
}
}
odd = !odd;
str+="</tr>";
}
str += "</table>" ;
document.write(str);
</script>
<style>
table {
margin: 100px auto;
border: 10px double rgb(31, 51, 59);
box-shadow: 5px 5px 10px #999; //阴影部分
}
td {
width: 50px;
height: 50px;
background-color: #ff0;
}
.td01 {
background-color: #fff;
}
.td02 {
background-color: #000;
}
</style>
</head>
<body>
</body>
</html>