1

I'm managing the website of my company which is based on Wordpress and I try to figure out how to change my contact page.

I've made a codepen of what I want to do : http://codepen.io/EzhnoFR/pen/PNmdxm

html :

  <img class="top" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/Isa.png" />
      <span>Hover</span>

</div>

        <div id="cf">
  <img class="bottom" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/christine-chute.png" />
  <img class="top" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/christine-1.png" />
  <span> Hover </span>
</div>

        <div id="cf">
  <img class="bottom" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/cecile-chute.png" />
  <img class="top" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/cecile.png" />
  <span> Hover </span>
</div>
    </div>

css :

#cf img.top {
  -webkit-filter: grayscale(80%);
    filter: grayscale(80%);
}

#cf img.top:hover {
  opacity:0;
}

span{
  position: absolute;
    bottom: -150px;
    left: 0;
    z-index: -1;
    display: block;
    width: 225px;
    margin: 0;
    padding: 0;
    color: black;
    font-size: 25px;
    text-decoration: none;
    text-align: center;
    -webkit-transition: .7s ease-in-out;
    transition: .7s ease-in-out;
    opacity: 0;
}

#cf img.top:hover ~ span{
  opacity: 1;
}
/*-----------------------------------------------------*/
.column {
    margin: 15px 15px 0;
    padding: 0;
}
.column:last-child {
    padding-bottom: 90px;
}
.column::after {
    content: '';
    clear: both;
    display: block;
}
.column div {
    position: relative;
    float: left;
    width: 300px;
    height: 200px;
    margin: 0 0 0 50px;
    padding: 0;
}
.column div:first-child {
    margin-left: 0;
}

However, when I add this html to my page and the css in my wordpress custom css, it all mess up as you can see : http://www.alabama-pub.com/contact-new-test/

I've tried a lot of things but I can't get to fix it, does anyone has any idea ?

21
  • 2
    you have extra br under image tag. Remove that. Commented Jun 16, 2016 at 7:23
  • @Leothelion On the page ? Commented Jun 16, 2016 at 7:25
  • On this page alabama-pub.com/contact-new-test under <div id = cf> then under image. Commented Jun 16, 2016 at 7:25
  • 1
    please remove z-index from span tag and you are done :) Commented Jun 16, 2016 at 7:39
  • 1
    Z-index will hide that text under the background. In fiddle you might not have that and text was hiding behind white background. Also you don't need padding-bottom:90px in .column:last-child(parent div) and make bottom:-62px in span tag of hover text. Try that :) Commented Jun 16, 2016 at 7:42

1 Answer 1

3

You have extra < br > under image tag which is causing the issue of height changes on hover.

According to other issue please remove z-index from span tag and you are done :)

see Here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.