3

I'm trying to make a simple CSS3 hover effect over the image. I'm trying half the image to show transparent. To make it easier to see the issue, I've set it as black.

<div class="section">
    <img src="http://placekitten.com/110/155" />
    <div class="efx" />
</div>

.section{
    width:700px;
    background-color:orange;
    height:170px;
    position:relative;
    margin:50px;
}

.section:hover .efx{
    height:155px;
}

img{
    width:110px;
    height:155px;
}

.efx{
    overflow:hidden;
    background-color: black;
    z-index: 10;
    left: -51px;
    position: absolute;
    height: 0px;
    width: 105px;
    transition: all .5s ease-in;
    transform: skew(35deg, 0deg);
    bottom:15px;   
}

If you look at the Fiddle here http://jsfiddle.net/5ST86/ you can see what the result is. Below is what I'm trying to achieve.

enter image description here

1 Answer 1

4

Just add overflow:hidden to the section element.

jsFiddle example

.section{
    width:700px;
    background-color:orange;
    height:170px;
    position:relative;
    margin:50px;
    overflow:hidden;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Josh. In the case of this, what would you recommend? jsfiddle.net/5ST86/3 I can't really change the mark-up too much. It seems to me one of those simple things that one just can't crack :(

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.