[CSS] Help

TrueJewix

Member
Aug 9, 2012
332
21
Hello, I need help with something.. alright I want the heart (html code ) to go blue after I hover it.

The heart was made using bootstrap (which im using) so I have to make the code by myself.. but I do not know how to make it.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
Use. Google.

Add the class heart-hover to the i element you show in the screen.
HTML:
$('.heart-hover').hover(
function() {
$(this).css('color', '#0000ff');
}, function() {
$(this).css('color', '');
});
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
what do I add in the 'this' part?
Nothing. You only add the heart-hover class to the i element and you put the JavaScript (/jQuery) code in your code. $(this) is a jQuery element. Please, read some tutorials on the internet. You want to make websites, but you put no effort in learning anything yourself.
 
You should go with @Rooster his solution. It's way better.
 

Swaggots

Member
Sep 22, 2013
98
18
As I said, I forgot and Rooster's solution is better. Read the entire thread, your comment is unnessecary.

Didn't see the merge, no need for attitude
 
To make the background of the heart a different color on hover, you're gonna have to place it in a class.

HTML:
// CSS

.heart-holder {
width: 50px;
height: 50px;
background: #000;
}

.heart-holder:hover {
background: #FFF;
}

// HTML

<div class="heart-holder">
<i class="heart or whatever"></i>
</div>
 

Users who are viewing this thread

Top