用CSS寫出的網頁動態表格交替顏色的效果

來源:互聯網
上載者:User
css|動態|網頁

<style type="text/css"><!-- tr {background-color:expression((this.sectionRowIndex%2==0)?"#419C33":"#CCEBC7")} --></style></HEAD><table><tr><td> evilpaw1</td><td>evilpaw 1</td></tr><tr><td>evilpaw2</td><td> evilpaw 2</td></tr><tr><td>evilpaw3</td><td>evilpaw3</td></tr><tr><td>evilpaw 4</td><td>evilpaw4</td></tr><tr><td>evilpaw5</td><td>evilpaw 5</td></tr></table>

    [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]

<style type="text/css"><!--tr {background-color:expression((this.sectionRowIndex%2==0)?"red":"blue")}td {background-color:expression((this.cellIndex%2==0)?"":((this.parentElement.sectionRowIndex%2==0)?"green":"yellow"))}--></style></HEAD><table><tr><td>第1行</td><td>第1行</td><td>第1行</td><td>第1行</td><td>第1行</td></tr><tr><td>第2行</td><td>第2行</td><td>第2行</td><td>第2行</td><td>第2行</td></tr><tr><td>第3行</td><td>第3行</td><td>第3行</td><td>第3行</td><td>第3行</td></tr><tr><td>第4行</td><td>第4行</td><td>第4行</td><td>第4行</td><td>第4行</td></tr><tr><td>第5行</td><td>第5行</td><td>第5行</td><td>第5行</td><td>第5行</td></tr></table>

    [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]



相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.