Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html] 第125天 举例说明table怎么合并行和列的? #1083

Open
haizhilin2013 opened this issue Aug 18, 2019 · 3 comments
Open

[html] 第125天 举例说明table怎么合并行和列的? #1083

haizhilin2013 opened this issue Aug 18, 2019 · 3 comments
Labels
html html

Comments

@haizhilin2013
Copy link
Collaborator

第125天 举例说明table怎么合并行和列的?

@haizhilin2013 haizhilin2013 added the html html label Aug 18, 2019
@weilaiqishi
Copy link

多条信息中同一类别(例学生的班级),纵向合并table表格单元格
rowspan属性用在td标签中,用来指定单元格纵向跨越的行数,可以理解为是占了多少位置而不是合并了多少个格子。被占了位置的那一条信息就不用再加同类别td了。
多类别想放到同一格里(例学生的姓名、年龄要放到同一格子),横向合并table表格单元格
colspan属性用在td标签中,用来指定单元格横向跨越的列数

@lm101845
Copy link

跨行合并:rowspan 跨列合并:colspan

合并单元格的思想:

将多个内容合并的时候,就会有多余的东西,把它删除。 例如 把 3个 td 合并成一个, 那就多余了2个,需要删除。

公式: 删除的个数 = 合并的个数 - 1

@lm101845
Copy link

<!DOCTYPE HTML>
<HTML lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<table width="400" height="100" border="1">
		<tr>
			<td>123</td>
			<td>abc</td>
			<td>abc</td>
		</tr>
		<tr>
			<td colspan="2">123</td>
			<td>测试</td>
		</tr>
		<tr>
			<td>123</td>
			<td>abc</td>
			<td>abc</td>
		</tr>

	</table>
	1. 先确认跨列合并 colspan
	2. 先上后下  先左右后
	3. 删除的个数
	
	<table width="400" height="100" border="1">
		<tr>
			<td>123</td>
			<td>abc</td>
			<td rowspan="3">abc</td>
		</tr>
		<tr>
			<td>123</td>
			<td>123</td>		
		</tr>
		<tr>
			<td>123</td>
			<td>abc</td>	
		</tr>
	</table>
	1. 先确认跨行合并 rowspan
	2. 先上后下  先左右后
	3. 删除的个数 

</body>
</HTML>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html html
Projects
None yet
Development

No branches or pull requests

3 participants