代码:
<style type="text/css">
table{
margin: auto;
width: 200px;
border-collapse: collapse;
border: 1px solid blue;
}
table td{
text-align: center;
padding: 3px;
font-size: 1.2em;
font-family: "Microsoft YaHei";
}
</style>
</head>
<body>
<table>
<%
for(int i=0;i<10;i++)
{
if((i+1)%2==1){
%>
<tr style="background: blue"><td>第<%=(i+1)%>行</td></tr>
<%
}
else{
%>
<tr style="background: pink"><td>第<%=(i+1)%>行</td></tr>
<%
}
}
%>
</table>
</body>
</html>
图片: