csosa
August 12, 2015, 5:28pm
1
Hello, I want to put text after I hover over an image
on my PAGE . Currently I have a fade transition when I hover. I know it has to do with the :after state and possibly the content element as well but im not sure how to use them.
IMAGE that I am targeting:
CSS: .
.docs:hover {
opacity: .2;
transition: opacity .5s ease-out;
-moz-transition: opacity .5s ease-out;
-webkit-transition: opacity .5s ease-out;
-o-transition: opacity .5s ease-out;
}
HTML:
<a href="pdf/IMPACTOGRAPHDEVICESCATALOG.pdf"><img class="docs" src="images/catalogimage.png" width="300" height="275" alt="catalogimages"></a>
Do you have the option to just modify the HTML?
You mention you want text after the image, right? So after <img>
csosa
August 12, 2015, 5:54pm
5
Right after I hover over it text appears.
Yeah, you donât need ot do this with :after, but hereâs how youâd do it.
a:hover:after {
content:'thing';
}
csosa
August 12, 2015, 6:08pm
7
wow I did try that before but instead of using the anchor I used the
like this but it did not work:
.doc:hover:after {
content:'thing';
}
it worked but then how would you control the position of the text?
Where would you like it to be? Youâd control it like any other normal element. Centered text? Display:block; and text-align:center it .
The image is class=âdocsâ so thatâs the first thing I notice about it not working . But yeah images canât have :after{} or pseudo elements like that.
1 Like
csosa
August 12, 2015, 6:25pm
10
Yeah centered in the image.
I tried that but It seems like its not relative to image.
it goes off.
Could we get an example? I looked on the page but couldnât find a section which had this implemented.
Make hte .doc_dl display:inline-block . Thatâll make it relative.
csosa
August 13, 2015, 12:03am
14
I did that still the same kinda:
.doc_dl:hover:after {
content:'Download';
color:#da272f;
font-size: 12pt;
font-weight: bold;
font-family: "open sans";
text-decoration: none;
margin-right: 3em;
text-align: center;
display: inline-block;
}
I didnât say the :after element.
1 Like
system
Closed
November 12, 2015, 8:03am
16
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.