简体   繁体   English

box-shadow无法正常工作

[英]box-shadow not working properly

I have a div tag, on hover on that div and I want to apply box-shadow . 我有一个div标签,悬停在该div上,我想应用box-shadow In that div there is image , label , and link button . 在该divimagelabellink button I just want to apply on div, not to each item that are inside of that div. 我只想申请div,而不是申请div中的每个项目。 But when I hover item of that div , box-shadow is applied to that item too. 但是,当我悬停该div项目时, box-shadow也会应用于该项目。

Here is the code 这是代码

<div class="itemshow">
    <asp:DataList ID="dlLatestItem" runat="server" RepeatDirection="Horizontal" DataKeyField="Pro_Id">
        <ItemTemplate>
            <div class="itemList">
                <table>
                    <tr>
                        <td colspan="3">
                            <asp:Image ID="imgPro_Latest" runat="server" Width="200" Height="200" ImageUrl='<%#Eval("Image") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="offer">
                                <asp:Label ID="lblOffer" runat="server" Text='<%#Eval("Offer") %>'></asp:Label>
                            </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            <div class="cart">
                                <asp:LinkButton ID="lnkCArt" runat="server">Add to Cart</asp:LinkButton>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" style="text-align:center">
                            <asp:Label ID="lblName" runat="server" Text='<%#Eval("Name") %>'></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="ViewItem">
                                <asp:LinkButton ID="lnkView" runat="server">View Item</asp:LinkButton>
                            </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            <div class="price">
                                <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price") %>'></asp:Label>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </ItemTemplate>
    </asp:DataList>
</div>

Here is the code for css 这是css的代码

.itemList {
    margin: 5px 18px 5px 0;
    border: 2px solid #5499c3;
    border-radius: 8px;
}
.itemList :hover {
    -moz-box-shadow: 0 0 10px #000000;
    -webkit-box-shadow: 0 0 10px #000000;
    box-shadow: 0 0 10px #000000;
}

Remove the space between .itemList and :hover 删除.itemList:hover之间的空格

.itemList {
    margin: 5px 18px 5px 0;
    border: 2px solid #5499c3;
    border-radius: 8px;
}

.itemList:hover {
    -moz-box-shadow: 0 0 10px #000000;
    -webkit-box-shadow: 0 0 10px #000000;
    box-shadow: 0 0 10px #000000;
}

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

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