代码之家  ›  专栏  ›  技术社区  ›  Fizzix

如何在悬停时向表tr元素添加框阴影?[副本]

  •  2
  • Fizzix  · 技术社区  · 12 年前

    所以我试图在我的桌子上添加一个盒子阴影 tr 元素。

    目前,它在Firefox中运行良好,但没有其他浏览器。

    CSS:

    table tbody tr:hover {
        background-color:#13326b;
        color:#ffffff;
        text-shadow: 1px 2px #000000;
        box-shadow: 0px 0px 10px #ff0000;
        -webkit-box-shadow: 0px 0px 10px #ff0000;
        -moz-box-shadow: 0px 0px 10px #ff0000;
    }
    

    HTML格式:

    <table class="table table-list-search">
            <thead>
                <tr>
                    <th>Logo</th>
                    <th>Name</th>
                    <th>Symbol</th>
                    <th>Sector</th>
                    <th>Sub-Sector</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Sample</td>
                    <td>Filter</td>
                    <td>12-11-2011 11:11</td>
                    <td>OK</td>
                    <td>123</td>
                </tr>
                <tr>
                    <td>Try</td>
                    <td>It</td>
                    <td>11-20-2013 08:56</td>
                    <td>It</td>
                    <td>Works</td>
                </tr>
                <tr>
                    <td>§</td>
                    <td>$</td>
                    <td>%</td>
                    <td>&</td>
                    <td>/</td>
                </tr>
            </tbody>
        </table>
    

    下面是它在Firefox中的显示方式:

    enter image description here

    以下是它在Chrome中的显示方式:

    enter image description here

    DEMO HERE

    我如何编辑我的CSS以将此框阴影悬停应用于所有浏览器?

    2 回复  |  直到 12 年前
        1
  •  7
  •   Jignesh Kheni    12 年前

    这是我编辑的css

    table { 
       box-sizing: border-box; 
       border-bottom: 1px solid #e8e8e8; 
    }
    table tbody tr:hover {
       background-color:#13326b;
       color:#ffffff;
       text-shadow: 1px 2px #000000;
       box-shadow: 0px 0px 10px #ff0000;
       -webkit-box-shadow: 0px 0px 10px #ff0000;
       -moz-box-shadow: 0px 0px 10px #ff0000;
    }
     td, th { 
        padding-left: 16px; 
        min-width: 170px; 
        text-align: left; 
    }
    tr { 
        display: block; 
    }
    table tbody tr , table tbody td{
        height:100px;
    } 
    

    这里是演示链接 - http://jsfiddle.net/Gx7Uy/6/

        2
  •  -9
  •   Community Mohan Dere    9 年前

    试试这样的东西, FIDDLE

    tr { display: block; }
    

    如需解释,请查看此项

    Box Shadow on table row not appearing on certain browsers