问题
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