Moving text on top of an image in hover state

ergo / 2013-12-05 15:14:56   

I am trying to move the text that appears when you hover on the top left image so that it aligns center and height on top of the image. At the moment I have only been able to move it all over the place, with no control even when incremental changes of 5px.
Any suggestions?
Site: lachlanpetras.com/

arsondpi / 2013-12-05 22:35:07   

I believe I posted a resolution of this (or maybe a close one).
I can't find it at the moment...

ergo / 2013-12-06 12:10:47   

@arsondpi Cool, hope you can find it - been searching forums but not found anything yet

arsondpi / 2013-12-06 16:47:17   

typed "Visual" in the Customize section of this forum and after a bit of searching, voila: indexhibit.org/forum/thread/20121/

ergo / 2013-12-07 12:08:51   

Mmm, thing is it's not Visual Index - it is something custom I have been trying to do.
Tried to implement some of the stuff from your link, but did not work.
Here is the code so far:

  1. .imgWrap {
  2.   position: relative;
  3.   height: 236px;
  4.   width: 250px;
  5. }

.imgDescription {
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
background: rgba(255, 255, 255, 0.7);
color: #FF8C00;
visibility: hidden;
opacity: 0;
-webkit-transition: opacity 1s;
-moz-transition: opacity 1s;
-o-transition: opacity 1s;
transition: opacity 1s;

}

.imgWrap:hover .imgDescription {
visibility: visible;
opacity: 1;

}

.crop {
width: 225px;
height: 225px;
overflow: hidden;
}

.crop img {

height: 100%;
width: auto;
margin: 0px 0px 0px -60px;

}

Any suggestions on how to get text to align to the middle?
I tried text-align: center; but then it varied from image to image...

arsondpi / 2013-12-07 14:46:05   

There's many ways - in the example I posted above I remember doing a web search on "how to center a div vertically".

Vaska A / 2013-12-07 15:39:40   

Centering a div vertically is not particularly easy - get ready to do some research. There is not a simple answer...

ergo / 2013-12-13 18:43:26   

Yes, not easy. Figured it out, with a slight compromise

  1. .imgWrap {
  2. position: relative;
  3. height: 236px;
  4. width: 250px;
  5. }

.imgDescription {
position: absolute;
height: 21px;
margin: 100px 0px 104px 0px;
padding: 7px 0px 0px 0px;
font-size: 13px;
font-weight:bold;
font-family: 'Helvetica Neue', Arial, Helvetica, Verdana, sans-serif;
text-transform:uppercase;
text-align: center;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
background: rgba(46, 46, 46, 1);
color: #FF8C00;
visibility: hidden;
opacity: 0;
-webkit-transition: opacity 1.5s;
-moz-transition: opacity 1.5s;
-o-transition: opacity 1.5s;
transition: opacity 1.5s;
}

.imgWrap:hover .imgDescription {
visibility: visible;
opacity: 1;
}

.crop {
width: 225px;
height: 225px;
overflow: hidden;
}

.crop img {
height: 100%;
width: auto;
margin: 0px 0px 0px 0px;
}

This thread has been closed, thank you.