简体   繁体   中英

CSS box shadow not working on Chrome

CSS box-shadow works on Mozilla, but not on Chrome. If I use the class on div (ie div with id mydiv ) it works! Why am I not allowed to use box shadow on tr tag?

<!DOCTYPE html>                                                    
<html lang="en">                                                   
    <head>                                                         
    <style>
        .item_row:hover {
        box-shadow: 0px 0px 8px 2px #CCCCCC inset;                 
        -moz-box-shadow: 0px 0px 8px 2px #CCCCCC inset;            
        -webkit-box-shadow: 0px 0px 8px 2px #CCCCCC inset;         
        }                                                          
    </style>
    </head>
    <body>
        <div id='mydiv'>
            <table>
                <tr class='item_row'>                              
                <td>test</td>
                </tr>                                              
            </table>                                               
        </div>
    </body>
</html>

Yes, just tested in Chrome. Instead of applying your css to the tr, instead apply to the child td:

.item_row:hover td {
  box-shadow: 0px 0px 8px 2px #CCCCCC inset;                 
  -moz-box-shadow: 0px 0px 8px 2px #CCCCCC inset;            
  -webkit-box-shadow: 0px 0px 8px 2px #CCCCCC inset;         
}                                                          

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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