I have this html code:
<div class="main-img">
<img id="main" src="http://i.ebayimg.com/00/s/NjU1WDgwMA==/z/HWIAAOSw8vZXMKGK/$_1.JPG?set_id=880000500F" alt="Teak Cleaner - 1lt bring back the original colour of teak/hardwood - Teak care" class="img-responsive main-image">
<p class="single-thumbnail-p">
<img src="http://i.ebayimg.com/00/s/NjU1WDgwMA==/z/HWIAAOSw8vZXMKGK/$_1.JPG?set_id=880000500F" class="img-responsive thumbnail" alt="Teak Cleaner - 1lt bring back the original colour of teak/hardwood - Teak care" />
<img src="http://i.ebayimg.com/00/s/MTEzMVgxNjAw/z/u8kAAOSw3mpXMKGT/$_1.JPG?set_id=880000500F" class="img-responsive thumbnail" alt="Teak Cleaner - 1lt bring back the original colour of teak/hardwood - Teak care" />
</p>
</div>
What i want to do is change the main image bacground or src using pure css, i know that src can not be changed but is there is any way with which i can change big image on hover of thumbnails ?
Thanks!
Both the thumbnails and the main image need to be siblings (or parent/child) for hover to work.
Based on your sample code I assume the
thumbnail
's should be below, so here I positioned them before themain-image
in the markup and used absolute to move them below, so CSS hover will work. You can also do this with Flexbox and its order property, though it has less browser support.You can use background image.Add above three images as background image.then on hover change background.