2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ]CSSで画像にhoverした時にzoomする方法

Last updated at Posted at 2016-10-18

①親要素.scalewidth,height,overflow:hidden;を設定
②変化前(hover前)にtransition:transform 0.5s linearで変化の仕方を記述
③変化後(hover後)にtransform:scale(1.2);で変化後の状態を記述

.scale {
    width: 400px;
    height: 300px;
    overflow: hidden;
}
.scale img {
    -moz-transition: -moz-transform 0.5s linear;
    -webkit-transition: -webkit-transform 0.5s linear;
    -o-transition: -o-transform 0.5s linear;
    -ms-transition: -ms-transform 0.5s linear;
    transition: transform 0.5s linear;
}
.scale img:hover {
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    -o-transform: scale(1.2);
    -ms-transform: scale(1.2);
    transform: scale(1.2);
}

(参考)
http://raining.bear-life.com/css/css3%E3%81%AE%E3%80%8Ctransformscale%E3%80%8D%E3%81%A7hover%E3%81%97%E3%81%9F%E6%99%82%E3%81%AB%E7%94%BB%E5%83%8F%E3%82%92%E6%8B%A1%E5%A4%A7%E3%81%99%E3%82%8B

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?