css caption-side属性怎么用

silencement
silencement 原创
2019-05-28 13:39:55 3008浏览

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>

运行结果

8e3e94d6adb48841ec82a9c66b52001.png

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

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。