chibi dude with 5 text boxes around them
so, i want to make each of these elements move down a bit when hovered over. each of them are separate images and link to a different page. they all belong to one div, but don’t have divs themselves. how do i get them all to individually move when hovered over??
whenever i try to do divs/classes with tutorials i read online, all the buttons still just stay in place. this is what my code looks like when everything is just static like the image shown before. (sorry if my code is rly janky im new to html)
html part:
<body>
<div id="directory_buttons">
<a href="https://google.com">
<img src="images/recs_button.png"
style="position:absolute;
top:450px;
left:220px;
width:150px;">
</a>
<a href="https://google.com">
<img src="images/dude_button.png"
style="position:absolute;
top:240px;
left:400px;
width:400px;"/>
</a>
<a href="https://google.com">
<img src="images/items_button.png"
style="position:absolute;
top:290px;
left:250px;
width:150px;"/>
</a>
<a href="https://google.com">
<img src="images/comichive_button.png"
style="position:absolute;
top:140px;
left:340px;
width:140px;">
</a>
<a href="https://google.com">
<img src="images/letters_button.png"
style="position:absolute;
top:80px;
left:510px;
width:140px;">
</a>
<a href="https://google.com">
<img src="images/arts_button.png"
style="position:absolute;
top:120px;
left:690px;
width:140px;">
</a>
</div>
</body>
css part:
<style>
#directory_buttons{
display: inline-block;
height: 500px;
width: 800px;
margin: auto;
position: absolute;
left: 300px;
top: 700px;
}
</style>
2
Answers
I recommend giving each image link its own unique div with a unique ID and using the :hover selector to shift them down. Also,
#
is only for ID selectors,.
is for classes. Something like this:You may also find this answer useful.
For this, I would use the selector
#directory-buttons a:hover
to select the links. Then, use thetranslate
property to move it down a few pixels.