LoginSignup
1
1

More than 5 years have passed since last update.

Safariでborder-radiusとtransitionが組み合わさるとおかしくなる

Last updated at Posted at 2015-04-16

画像を楕円で表示し、マウスオーバーしたら拡大(ズーム)させたかった。

<div class="thumbnail">
    <img src="sample.jpg">
</div>
.thumbnail {
position: relative;
  width: 250px;
  height: 250px;
  border: 2px solid #ccc;
  border-radius: 125px / 125px;
  overflow: hidden;
  z-index: 1;
}

.thumbnail img {
  -webkit-transition: -webkit-transform 0.3s linear;
  -moz-transition: -moz-transform 0.3s linear;
  -o-transition: -o-transform 0.3s linear;
  -ms-transition: -ms-transform 0.3s linear;
  transition: transform 0.3s linear;
  z-index: -1;
}
.thumbnail:hover {
  border: 2px dotted #ccc;
}
.thumbnail:hover img{
  -webkit-transform: scale(1.1);
  -moz-transform: scale(1.1);
  -o-transform: scale(1.1);
  -ms-transform: scale(1.1);
  transform: scale(1.1);
}

Chromeなどでは、理想どうりに動いたが、Safariでは、一瞬四角い画像が表示されてからズームする。
border-radius,transitionいずれをなくすと四角い画像が表示されることはない。(表示されているのかもしれないが、人間の目には見えない…)

1
1
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
1
1