html 表格

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <title>可编辑表格</title>
        <style>
        	table{
        		margin:0 auto; /* 表格居中 */
        		font-size:30px; /* 字体大小 */
        		width:800px; /*表格宽度 */
        		text-align: center;/* 内容居中 */
        		background: #FFF; /* 背景色 */
        		table-layout: fixed;/* 表格布局是根据内容 还是 固定大小 (搭配td/th width属性使用) */
        		empty-cells: hide; /*是否显示空的单元格 hide后 空单元格框就没了 */
        		border-collapse:separate; /* 边框塌陷 外边框就没了 */
        		border-spacing:15px 30px; /* 先左右 后上下 td之间间隔  不能设置边框塌陷*/
        		/*background-color: blue;*/
        	}
        	caption{
        		caption-side: bottom; /*设置标题位置 */
        	}
        	table th{
        		border:1px solid gold;  /*th边框*/
        	}
        	table td{
        		border:1px solid red;   /*td边框*/
        	}
        	table tr:nth-child(even){ /*设置偶数行颜色 */
	            background-color: #FFF;
	        }
	        
	        table tr:nth-child(odd){/*设置奇数行颜色 */
	            background: red;
	        }
	        table th{
	        	background-color: pink;/*设置标题颜色 */
	        }

        </style>
    <head>
<body>

<form>
	<table frame="box" id="table1">
		<caption>This is a caption</caption>
		<tr>
			<th>标题1</th>
			<th>标题2</th>
		</tr>
		<tr>
		<td>
			内容1
		</td>
		<td></td>
		</tr>
		<tr>
		<td>
			内容2
		</td>
		<td>neirong2</td>
		</tr>
		<tr>
		<td>
			内容3
		</td>
		<td>neirong3</td>
		</tr>
	</table>
</form>
</body>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值