代码的书写规范?

来源:2-5 带标题、表头和结构的表格

雪夜煮酒

2017-04-04 17:24:57

如果代码的行数太多的,会看的很乱。那么请问:代码
有没有什么书写的规范?
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

	<table border="1" width="500px">

	<caption>前段工程师薪水</caption>

	<thead>
		<tr>
			<th>城市</th>
			<th>2014</th>
			<th>2014</th>
			<th>2015</th>
			<th>2015</th>
			<th>2016</th>
			<th>2016</th>
		</tr>
	</thead>

	<thead>
		<tr>
	 		<th>城市</th>
			<th>上半年</th>
			<th>下半年</th>
			<th>上半年</th>
			<th>下半年</th>
			<th>上半年</th>
			<th>下半年</th>
		</tr>
	</thead>

	<tbody>
		<tr>
			<td>北京</td>
			<td>8000</td>
			<td>9000</td>
			<td>10000</td>
			<td>12000</td>
			<td>12000</td>
			<td>13000</td>
		</tr>
	</tbody>

 	<tbody>
		<tr>
			<td>上海</td>
			<td>6000</td>
			<td>7000</td>
			<td>8000</td>
			<td>10000</td>
			<td>110000</td>
			<td>12000</td>
		</tr>
	</tbody>

	<tfoot>
		<tr>
			<td>合计</td>
			<td>7000</td>
			<td>8000</td>
			<td>9000</td>
			<td>11000</td>
			<td>12000</td>
			<td>13000</td>
		</tr>
	</tfoot>
</table>
</body>
</html>


写回答

1回答

小丸子爱吃菜

2017-04-04

代码其实这样写就可以了,如果感觉代码比较多,可以适当的在代码中添加一些注释,方便后期的维护,代码中间不要有没必要的空行存在。

祝学习愉快!

0

0 学习 · 36712 问题

查看课程