html中table的使用(1)课程表

<!DOCTYPE html>

<html>
<head>
<title>课程表</title>
<style type="text/css">
*{margin:0;padding:0;background:#ffffff;}
table{
margin:10px;
width:600px;
height:400px;
border-left:1px solid #666666;
border-bottom:1px double #666666;
}
caption{
border-right:1px solid #666;
border-top:1px solid #666;
border-left:1px solid #666;
padding: 10px 0 10px 0;
background-color:#F5F5F5;
}
thead tr th{
padding: 10px 0 10px 0;
background-color:#90EE90;
border-bottom:1px double #000080;
}
tbody tr{
text-align:center;

}
tfoot tr td{
padding: 10px 0 10px 5px;
background-color:#2E8B57;
color:#ffffff;
}
th,td{
border-right:1px solid #666;
border-top:1px solid #666;
}
.firstcol{
background-color:#F5F5F5;
}
.topline2px td{
border-top:2px double #2F4F4F;
}
.weekend{
background-color:#FFB6C1;
}
</style>
</head>
<body>
<table border="0" cellspacing="0"cellpadding="0">
<caption>2015~2016学年第二学期课程表</caption>
<thead>
<tr>
<th style="background-color:#9ACD32;">节次</th>
<th>星期一</th>
<th>星期二</th>
<th>星期三</th>
<th>星期四</th>
<th>星期五</th>
<th class="weekend">星期六</th>
<th class="weekend">星期日</th>
</tr>
</thead>
<tbody>
<tr>
<td class="firstcol">123节</td>
<td>语文</td>
<td>数学</td>
<td>音乐</td>
<td>体育</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="firstcol">45节</td>
<td>数学</td>
<td>语文</td>
<td>美术</td>
<td>化学</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="topline2px">
<td class="firstcol">67节</td>
<td>美术</td>
<td>劳动</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="firstcol">89节</td>
<td>体育</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="topline2px">
<td class="firstcol">1011节</td>
<td>自习</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr class="foottr"><td colspan="8">注意:</td></tr>
</tfoot>
</table>
</body>
</html>

------------------------------------------------------------------------------------------------------------------------------------------------------

注:

一、关于文本对齐
1.如果在标签内部,则使用align="center"
2.如果使用css控制,则使用text-align="center"

二、 table的border="0" cellspacing="0"cellpadding="0"直接写在标签内,写在CSS里不起作用

三、单元格四周都有线会出现“双线”边界效果,影响美观。“单线”表格线的一个实现方法:

css控制表格只显示左、下线,单元格只显示右上线

table{
border-left:1px solid #666666;
border-bottom:1px double #666666;
}

th,td{
border-right:1px solid #66
6666;
border-top:1px solid #6
66666;
}

--------------------------------------------------------------------------------------------------------------------------------------------------------

效果图:


  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在ECharts Table (el-table) ,它是一个用于展示数据表格的强大组件,常用于Vue.js的Element UI库。如果你想要用el-table实现课程表,你可以按照以下步骤操作: 1. **安装依赖**: 首先确保你在项目已经安装了Element UI,如果没有,可以使用`npm install element-ui` 或 `yarn add element-ui`来安装。 2. **引入组件**: 在你的Vue组件文件里,import ElTable 和相关的列定义如ElColumn。 ```html <template> <el-table ref="table" :data="courseList"> <!-- ... --> </el-table> </template> <script> import { ElTable, ElColumn } from 'element-ui'; export default { components: { ElTable, // 如果有列需要自定义,比如教师名、课程名等 TeacherNameColumn: () => ({ render: (h, params) => h('span', params.row.teacherName) }), CourseNameColumn: () => ({ render: (h, params) => h('span', params.row.courseName) }) }, data() { return { courseList: [ // 假设这是你的课程数据,包括字段如teacherName、courseName等 { teacherName: '张三', courseName: '计算机科学入门' // 其他课程信息... }, // 更多课程... ] }; } }; </script> ``` 3. **配置列**: 使用ElColumn定义每列的数据格式和样式,包括标题和显示内容。 4. **事件处理**: 可以利用el-table提供的内置事件,如`@selection-change`处理选行的操作,`@row-click`处理点击行的操作。 ```html <template> <el-table ref="table" :data="courseList" @selection-change="handleSelectionChange" @row-click="handleRowClick" > <el-column type="index"></el-column> <!-- 列头序号 --> <el-column prop="teacherName" label="教师姓名" :render="TeacherNameColumn"></el-column> <el-column prop="courseName" label="课程名称" :render="CourseNameColumn"></el-column> <!-- 添加更多列... --> </el-table> </template> <script> // ... 在data添加处理函数 methods: { handleSelectionChange(selection) { console.log('选择了以下课程:', selection); }, handleRowClick(row) { console.log(`单击了行:${JSON.stringify(row)}`); } } </script> ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值