zoukankan      html  css  js  c++  java
  • table样式

    一直以来,css和JS都是软肋,因为需要不得不重新温故。

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style type="text/css">
            table.hovertable
            {    font-family: verdana,arial,sans-serif;
                font-size:11px;    color:#333333;
                border: 1px solid #C3DDE0;
                border-collapse: collapse;}
            table.hovertable th
            {    background-color:#F0F0F0;
                border-width: 1px;
                padding: 8px;
                border-width: 1px;
                border-style: solid;
                border-color: #C3DDE0;}
            table.hovertable tr
            {    background-color:#FFFFFF;
                border-width: 1px;
                border-style: solid;
                border-color: #C3DDE0;
    
            }
            table.hovertable.hover,table.hovertable tr.altrow
            {
               background-color:#d4e3e5 ;
            }
            table.hovertable td
            {    border-width: 1px;
                padding: 8px;    border-style: solid;    border-color: #C3DDE0;}
    
        </style>
        <script type="text/javascript" >
            window.onload = function () {
                var rows = document.getElementsByTagName("tr");
                for (var i=1; i<=rows.length;i++){
                    rows[i].onmouseover=function(){
                        this.className +='altrow';//鼠标经过时,显示样式altrow
                    }
                    rows[i].onmouseout = function(){
                        this.className = this.className.replace('altrow','');//鼠标走的时候,显示样式清空
                    }
    
                }
    
            }
    
        </script>
    </head>
    <body>
    <table class="hovertable">
        <tr>
            <th>Info Header 1</th>
            <th>Info Header 2</th>
            <th>Info Header 3</th>
        </tr>
        <tr>
            <td>Item 1A</td>
            <td>Item 1B</td>
            <td>Item 1C</td>
        </tr>
        <tr>
            <td>Item 2A</td>
            <td>Item 2B</td>
            <td>Item 2C</td>
        </tr>
        <tr>
            <td>Item 3A</td>
            <td>Item 3B</td>
            <td>Item 3C</td>
        </tr>
        <tr>
            <td>Item 4A</td>
            <td>Item 4B</td>
            <td>Item 4C</td>
        </tr>
        <tr>
            <td>Item 5A</td>
            <td>Item 5B</td>
            <td>Item 5C</td>
        </tr>
    </table>
    </body>
    </html>
  • 相关阅读:
    Class文件和JVM的恩怨情仇
    详解及对比创建线程的三种方式
    浅析Java中线程组(ThreadGroup类)
    简单定义多线程!
    五分钟看懂UML类图与类的关系详解
    LeetCode刷题--14.最长公共前缀(简单)
    LeetCode刷题--13.罗马数字转整数(简答)
    动态规划算法详解及经典例题
    LeetCode--9.回文数(简单)
    LeetCode刷题--7.整数反转(简单)
  • 原文地址:https://www.cnblogs.com/sincoolvip/p/6283984.html
Copyright © 2011-2022 走看看