我需要用不同的颜色动态填充表格中的行。我使用:
-webkit-linear-gradient
例如,我有#729fcf 20%, #93971c 20% 30%, #16eab7 30% 20%, #427b70 20% 20%, #861d53 20% 10%
,但我得到了三种颜色而不是五种
颜色和列的数量可以不同,并且不应相互依赖。http://jsfiddle.net/01wy9Lso/1/
* {margin:0;padding:0;border:0;border-collapse:collapse;}
table {
width:100%;
}
th {
border: 2px solid black;
}
tbody {
background: -webkit-linear-gradient(left, #729fcf 20%, #93971c 20% 30%, #16eab7 30% 20%, #427b70 20% 20%, #861d53 20% 10%);
background-attachment:fixed;}
thead tr, thead th { background:transparent; }
/* #a13131 #93971c #93971c #16eab7 #861d53 #427b70 */
<table>
<thead>
<tr>
<th>One</th>
<th>Two</th>
<th>Three</th>
</tr>
</thead>
<tbody>
<tr>
<td>un</td>
<td>deux</td>
<td>trois</td>
</tr>
</tbody>
</table>
您误解了色标的工作原理,它们需要总是