使用表格的时候,经常会用到斜线表头,如下图所示。
网上搜到的方法,通常是利用js实现斜线绘制。参考:http://qinya.iteye.com/blog/1836637
这种方式比较麻烦,要动用js,有点杀鸡用牛刀的感觉。
于是,想着通过css实现表头斜线。原理很简单,就是通过css3的background-size属性实现背景图片自适应填充。
背景图片为一个16px*16px的斜线图片。
代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
.a-ca-head-title {
border-right: solid 1px #e5e5e5;
background-color: white;
padding: 0 !important;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
table th {
p