61,112
社区成员
发帖
与我相关
我的任务
分享
#mytab td:nth-child(1) { /*第一列*/
width: 100px;
}
#mytab td:nth-child(2) { /*第二列*/
width: 200px;
}
<table id="mytab">.
<colgroup width="100"></colgroup>
<colgroup width=""></colgroup>
<colgroup width=""></colgroup>
<colgroup width=""></colgroup>
<thead>
<tr>
<td>项目名一</td>
<td>项目名二</td>
<td>项目名三</td>
<td>项目名四</td>
</tr>
</thead>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
<style type="text/css">
body {
background-color: #0ff;
}
#mytab {
width: 100%;
border-spacing: 0px 5px;
}
#mytab td {
text-align: center;
font-size: 20px;
height: 30px;
background-color: #fff;
color: #099;
}
#mytab td:first-child {
border-radius: 10px 0px 0px 10px;
}
#mytab td:last-child {
border-radius: 0px 10px 10px 0px;
}
#mytab thead td {
background-color: #099;
color: #fff;
}
</style>
</head>
<body>
<table id="mytab">
<thead>
<tr>
<td>项目名一</td>
<td>项目名二</td>
<td>项目名三</td>
<td>项目名四</td>
</tr>
</thead>
<tbody>
<tr>
<td>内容一</td>
<td>内容二</td>
<td>内容三</td>
<td>内容四</td>
</tr>
<tr>
<td>内容一</td>
<td>内容二</td>
<td>内容三</td>
<td>内容四</td>
</tr>
<tr>
<td>内容一</td>
<td>内容二</td>
<td>内容三</td>
<td>内容四</td>
</tr>
<tr>
<td>内容一</td>
<td>内容二</td>
<td>内容三</td>
<td>内容四</td>
</tr>
</tbody>
</table>
</body>
</html>