Background-size transitions in Chrome 51 - a bug or a feature?

不想你离开。 提交于 2019-12-17 20:50:00

问题


Background-size transitions are no longer working in Chrome 51. I know that it was never supposed to work (see this), but it did and still many people used it. I'm talking about percentage transitions on hover.

I'm wondering if this is a bug in the new Chrome (which is possible, since this version brings a lot of new stuff), or they've decided to remove that transition for good?

No issues in other browsers.


div {
  background: url(http://cdn2.business2community.com/wp-content/uploads/2014/12/Super-Mario-no-longer-the-007.jpg) no-repeat center center;
  background-size: 50%;
  display: inline-block;
  height: 276px;
  width: 460px;
  transition: all 0.5s linear;
}
div:hover {
  background-size: 100%;
}
<div></div>

UPDATE

As @Paran0a noticed, it works fine with vendor-specific prefix, so it's probably a bug (submitted a bug-report):


div {
  background: url(http://cdn2.business2community.com/wp-content/uploads/2014/12/Super-Mario-no-longer-the-007.jpg) no-repeat center center;
  -webkit-background-size: 50%;
  display: inline-block;
  height: 276px;
  width: 460px;
  transition: all 0.5s linear;
}
div:hover {
  -webkit-background-size: 100%;
}
<div></div>

回答1:


Turns out this was a bug: https://bugs.chromium.org/p/chromium/issues/detail?id=616072

It's scheduled to be fixed in the next milestone, and this is the patch: https://chromium.googlesource.com/chromium/src.git/+/8793a7bac4d2d56e38c8bd406920128e1ceb7a9a




回答2:


Had this problem and was able to fix it by changing my rules from

background-size: 115%;

to

background-size: 115% 115%;



来源:https://stackoverflow.com/questions/37545089/background-size-transitions-in-chrome-51-a-bug-or-a-feature

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!