如果要在网页上做一个5*7的课程表,根据DIV+CSS标准,是在DIV里嵌套DIV?还是在DIV里嵌套一个5*7的表格?
我这有个成绩表,跟课程表差不多,下面是代码index.html 和index.css:你自己改改就行了
//index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表格运用-成绩表</title>
<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table id="scorelist">
<caption>1011级学生成绩表</caption>
<tr>
<th>姓名/科目</th>
<th>php</th>
<th>html</th>
<th>c语言</th>
<th>photoshop</th>
</tr>
<tr> <!--奇数行-->
<th>张三</th>
<td>100</td>
<td>90</td>
<td>80</td>
<td>60</td>
</tr>
<tr class="evencolor"><!--偶数行-->
<th>李四</th>
<td>120</td>
<td>60</td>
<td>70</td>
<td>80</td>
</tr>
<tr><!--奇数行-->
<th>张三</th>
<td>100</td>
<td>90</td>
<td>80</td>
<td>60</td>
</tr>
<tr class="evencolor"><!--偶数行-->
<th>李四</th>
<td>120</td>
<td>60</td>
<td>70</td>
<td>80</td>
</tr>
</table>
</body>
</html>
//index.css
@charset "utf-8";
/* CSS Document */
body{
background-color:#E2FCF9;
font-family:12px;
padding:4px;
margin:0;}
#scorelist{
margin:0 auto;
border:1px solid #429fff;
border-collapse:collapse; /* 边框重叠 */}
#scorelist caption{
color:#066;
font:500 25px 黑体;
border:1px solid #429fff;}
#scorelist th{
background-color:#6CC;
width:80px;
border:1px solid #429fff;}
#scorelist td{
border:1px solid #429fff;}
#scorelist tr.evencolor{
background-color:#366;}
显示效果: