lundi 9 mars 2015

How to select an image within 'b' div after hovering over 'a' div?


Bumped into many examples but couldn't get it to work.



echo '<div id="portalcontent">';
echo '<a href="/post.php?id='.$postid.'" title="Read More" >';
echo '<div id="featured">';
echo '<img src="/media.php?id=' . $postid . '" alt="' . $posttitle . '" title="Read More" />';
echo '</div>';
echo '</a></div>';


I have tried the following so far:



#portalcontent a:hover > #featured img
#portalcontent a:hover > img
#portalcontent a:hover + #featured img
#portalcontent a:hover + img


I currently have:



echo '<div id="portalcontent">';
echo '<a href="/post.php?id='.$postid.'" title="Read More" >';
echo '<img src="/media.php?id=' . $postid . '" alt="' . $posttitle . '" title="Read More" />';

#portalcontent a:hover > img { }


This only seems to work when I hover over the image, not the div.





Aucun commentaire:

Enregistrer un commentaire