Here are my HTML code segments:
<div class="div-builder">
<div>
<a href="#">
<img src="/photos/20/Apple-Logo-icon.png" width="50" alt="Logo">
</a>
<h3>Title</h3>
<i>sub-title</i>
</div>
<hr/>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting ...</p>
</div>
I want to create a hover effect for the .div-builder class where its background color changes according to this CSS:
.div-builder{ background-color: lightyellow; }
The desired result should look like the image shown in this link: https://i.sstatic.net/U1PRe.jpg
In addition, when hovering over the <img>
tag, I also want its background color to change to lightyellow without affecting the .div-builder class. The result should be similar to the image in this link:
https://i.sstatic.net/PXt5E.jpg
The <img>
tag can be at any level within the .div-builder class. Similarly, the <h3>
, <i>
, or <p>
tag should change their background color to lightyellow on hover, with the .div-builder class background color remaining unchanged. After hovering over the <p>
tag, the result should resemble the image here:
https://i.sstatic.net/KaXes.jpg
Is there a way to achieve this hover effect using CSS?
Alternatively, how can I implement this click event instead of a hover effect using jQuery?