CSS之表格

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>CSS表格</title>
	<style type="text/css">
		/*表格边框*/
		table,th,td{
			border:1px solid blue;
		}
		/*折叠边框 border-collapse 
		设置是否把表格边框合并为单一的边框。
		separate:默认值,边框会被分开
		collapse:边框会被合并为一个单一的边框
		*/
		table{
			border-collapse:collapse;
		}
		/*分隔单元格边框的距离 border-spacing*/
		table{
			border-spacing:10px 20px;
		}
		/*表格宽度和高度 width和height属性 */
		table{
			width:100%;
			height:100px;
		}
		/*表格td文本对齐
		*水平对齐:text-align:right/left/center;
		*垂直对齐:vertical-align:bottom/top;
		*/
		td{
			/*text-align:center;*/
			vertical-align:bottom;
		}
		/*表格内边距 padding*/
		td{
			padding:10px;
		}
		/*表格颜色*/
		th{
			background-color:green;
			color:white;
		}
		/*表格布局 table-layout
		automatic:默认值,列宽度由单元格内容决定
		fixed:列宽由表格宽度和列宽度决定
		*/
		table{
			table-layout:fixed;
		}
	</style>
</head>
<body>
	<table>
		<th>eee</th>
		<tr>
			<td>ee</td>
			<td>ee</td>
		</tr>
		<tr>
			<td>ee</td>
			<td>ee</td>
		</tr>
		<tr>
			<td>ee</td>
			<td>ee</td>
		</tr>
		<tr>
			<td>ee</td>
			<td>255</td>
		</tr>
	</table>
</body>
</html>
在使用过程中table-collapse:collapse是边框合并为单一的边框,使表格效果更漂亮
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值