0

I have a picture that I want to scale to 150% and also move 30px down, with a transition. Only the scale seems to work, any help?

img {
    transition: transform 250ms;
}

img:hover {
    transform: scale(1.5);
    transform: translateY(30px);
}
3
  • What do you mean by proceed? You mean precede, and come before the translation? Commented Jul 5, 2016 at 20:26
  • Please add a minimal reproducible example to your question Commented Jul 5, 2016 at 20:27
  • @Adjit As in only the scaling works Commented Jul 5, 2016 at 20:29

1 Answer 1

1

You just need to combine your transform properties

transform: scale(1.5) translateY(30px);

Should do the trick!

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

2 Comments

Thanks :) Been trying to combine them, but I tried using commas.
Sure thing! This also applies to changing just one transform property - for example, if you wanted to do just a scale on hover and your translateY was on the default state, you'd still need to set both on the hover, even though the translateY wouldn't change.

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.