简体   繁体   中英

Hover over one one div element to display 2 div child elements

Here is my piece of code:

<div class="print">

    <a href="#"><img src="images/icons/185-printer.png" width="18" height="18" alt="printicon"/</a>

    <div class="print_text">Print page</div>

    <div class="triangle"></div>

 </div>

What I'm trying to is when I hover over the print class, it shows both print_text class and triangle class. Is there any chance to do this? It would help me a lot. Thank you in advance!

Try this:

.print_text, .triangle { display: none; }
.print:hover .print_text, .print:hover .triangle { display: block; }
.print > div { display:none; }
.print:hover > div{ display:block; }

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