html - how to change the background of a css-class by hover a button? -



html - how to change the background of a css-class by hover a button? -

i alter background image of div hover button. key:

.content-portfolio { background-image: url(../files/portfolio/event.jpg) no-repeat; } #event-button a:hover{ }

i dont know how it, hope help me!

best regards!

it's pretty hard css. utilize javascript that. but, found way want if div immediate sibling of button (with no other elements between two).

the code this:

html

<input type="button" id="btn" value="click me !" /> <div id="testdiv"> <p>some content</p> </div>

css

#btn:hover + #testdiv { background-color: red; } #testdiv { border-style: solid; width: 200px; height: 200px; }

the operator "+" or "~" apply css next sibling element. here's js fiddle show tricks.

if remove "+" apply css descendant/child of left element. more info can check out this page.

html css button hover

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -