I'm trying to make a circle button (I was thinking submit button or link to another page) that has a label/text on it, and then when you hover it has different text. I've been able to find tutorials on all of these things individually, but together I can't quite get them to work.
Currently I have:
HTML
<div class='button'>
<a href='activities.php'>
<div class='text'> hello world </div>
<img src="/Images/budapest.jpg">
</a>
</div>
CSS
.button img { /*http://codeitdown.com/css-round-buttons/*/
display: block;
width: 30vmin;
height: 30vmin;
line-height: 50px;
border: 2px;
border-radius: 50%;
color: #000000;
text-align: center;
text-decoration: none;
background: #000000;
font-size: 20px;
font-weight: bold;
z-index: 1;
}
.text{
display: block;
}
.text:hover {
display: none;
z-index: 2;
}
.button input[type=submit].nav {
font-family: 'Optima', sans-serif;
height: auto;
width: auto;
background: #111111;
border-radius: 1vmin;
color: #FFFFFF;
font-size: 2vmin;
z-index: 2;
}
The button currently is the image I want - yay, and indeed redirects to the correct page. However, the text "hello world" always shows (instead of only when on hover), is above the image (not on top of it), and I can click on it or the button to redirect me. Also, how do I get the text to change when I hover?
Update
The remaining problem is that the text is not inside the button/image.
My Code
.button img { /*http://codeitdown.com/css-round-buttons/*/
display: block;
width: 30vmin;
height: 30vmin;
line-height: 50px;
border: 2px;
border-radius: 50%;
color: #000000;
text-align: center;
text-decoration: none;
background: #000000;
font-size: 20px;
font-weight: bold;
z-index: 1;
}
.button .text-after {
display: none;
}
.button:hover .text-after {
display: inline;
}
.button:hover .text-before {
display: none;
}
<div class='button'>
<a href='activities.php'>
<span class="text-before">Before</span>
<span class="text-after">After</span>
<img src="/Images/budapest.jpg">
</a>
</div>