css caption-side属性怎么用-LMLPHP

css caption-side属性定义及用法

1、在css中,caption-side属性是用来规定表格标题的位置,表格标题可以设置在表格之上(默认),也可以设置在表格之下

2、目前所有主流浏览器都支持caption-side属性,但是IE8必须要指定!DOCTYPE才支持

css caption-side属性值

top:表格标题在表格之上(默认)

bottom:表格标题在表格之下

inherit:从父元素继承 caption-side 属性的属性值

语法格式

caption-side:top / bottom / inherit;
登录后复制

实例

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>css caption-side表格标题属性笔记</title>
<style>
table{width:400px; height:150px;}
caption{caption-side:top;}
</style>
<head/>
<body>
<table border="1">
<caption>学生成绩表</caption>
<tr><th>学号</th><th>姓名</th><th>性别</th><th>成绩</th></tr>
<tr><td>1</td><td>张三</td><td>男</td><td>60</td></tr>
<tr><td>2</td><td>李四</td><td>男</td><td>80</td></tr>
</table>
</body>
</html>
登录后复制

运行结果

css caption-side属性怎么用-LMLPHP

以上就是css caption-side属性怎么用的详细内容,更多请关注Work网其它相关文章!

09-13 09:41