简体   繁体   English

如何使用单个连续渐变影响表格的一侧

[英]How to use a single continuous gradient that on affects one side of a table

I'm wondering if there is an "easy" way to gradient only one side of a table (ie: only the far left column) without doing each gradient individually to give the look of being continuous? 我想知道是否存在一种“简单”的方法来仅对表格的一侧进行渐变(即:仅最左侧的列),而无需单独进行每个渐变以给出连续的外观?

So in this code the dates should be colored and the color should start white and be a solid color at the bottom and all of the text should stay white 因此,在此代码中,日期应为彩色,颜色应从白色开始,在底部为纯色,所有文本应保持白色

Please help, otherwise I'm in for a long night of headaches 请帮忙,否则我整晚头痛

<table>
    <tr>
        <td>1990</td>
        <td>words and things</td>
        <td>more words and things</td>
    </tr>
    <tr>
        <td>2000</td>
        <td>no color here</td>
        <td>nor color here</td>
    </tr>
    <tr>
        <td>2010</td>
        <td>this should be white</td>
        <td>and this too</td>
    </tr>
    <tr>
        <td>2020</td>
        <td>Oh the places you'll go</td>
        <td>the magic that is CSS</td>
    </tr>
    <tr>
        <td>2030</td>
        <td>I am but a lowly peon</td>
        <td>take pity upon my soul</td>
    </tr>
</table>

You can make your cross-browser gradient styles here: http://www.colorzilla.com/gradient-editor/ 您可以在此处制作跨浏览器的渐变样式: http : //www.colorzilla.com/gradient-editor/

And some styles here - replace the comments with the stuff the generator creates for you: 这里还有一些样式-用生成器为您创建的内容替换注释:

tbody tr td:first-child {
    /* this will apply to the first cell in each row */
}

tbody tr td:first-child + td {
    /* this will apply to the second cell in each row */
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM