This is an extension of my previous question described on this SO link
From the given solution i am able to get on hover effect. but the problem is im not able to give different image to different . Can anyone suggest me some solution!
You have multiple options:
Give specific id
's to each <li>
for eg, let's say you apply id
's first, second and third respectively for the <li>
's You can add the background as follows:
#first{ background: url("/path-to-image"); } #second{ background: url("/path-to-image"); } #third{ background: url("/path-to-image"); }
Use different classes ( i prefer id
's since classes are meant to be used to group elements )
Use CSS pseudo selectors.
.wrap li:nth-child(1){ background: url("/path-to-image"); } .wrap li:nth-child(2){ background: url("/path-to-image"); } .wrap li:nth-child(3){ background: url("/path-to-image"); }
like this
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.