html表格两种颜色,html – 表格细胞两个颜色背景对角线

现有的答案都很好,这并不是试图以任何方式将它们放下.这是对它们的改进,如果您想要具有渐变的响应式设计,可以使用它们.

正如在其他两个答案中已经提到的(并在下面的片段中看到),如果td的高度或宽度发生变化,则应修改渐变的角度.当设计必须响应时这是一个缺点,但是当使用to [side] [side]渐变语法而不是倾斜渐变时可以避免这种情况.此语法可以适应维度的任何更改.

td {

background: linear-gradient(to top right,#167891 49.5%,#0D507A 50.5%);

color: #fff;

}

里面的文字需要额外的定位才能使它看起来与问题完全一样.

tr:nth-child(3) td {

background: linear-gradient(to top right,#0D507A 50.5%);

color: #fff;

}

tr:nth-child(1) td {

background: linear-gradient(18deg,#167891 50%,#0D507A 51%);

color: #fff;

}

tr:nth-child(2) td {

background: linear-gradient(33deg,#0D507A 51%);

color: #fff;

}

/* Just for demo */

table {

float: left;

}

table:nth-child(2) td {

height: 50px;

}

table:nth-child(3) td {

height: 100px;

}

table:nth-child(4) td {

height: 150px;

}

Two Color Background
Two Color Background
Two Color Background
Two Color Background
Two Color Background
Two Color Background
Two Color Background
Two Color Background
Two Color Background
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值