html - 如何使 Css 过渡效果在 Safari 和 Chrome 上工作?

标签 html css google-chrome safari css-transitions

我有一个例子http://codepen.io/carlosjgsousa/pen/xaewg我遇到了让代码在 Chrome 和 Safari 上运行的问题,它在 Firefox 上运行良好。

body {
    background: #292f33;
    text-align:center;
    color: #FFF;
    font-family: sans-serif;
}

.btntest {
    width: 190px;
    padding:4px;
    border-radius: 5px;
    background: red;
    color: white;
    z-index:299;
    position: fixed;
}

感谢您解决这个问题!

最佳答案

试试这个:

.button:hover {
      -webkit-animation: pulse 1.1s ease-out;
      -webkit-animation-iteration-count: infinite; 
      animation: pulse 1.1s ease-out;
      animation-iteration-count: infinite; 
    }
    @keyframes pulse {
        0% {
          box-shadow: 0 0 0 0 rgba(85,172,238,0);
        }
        25% { 
          box-shadow: 0 0 0 2px rgba(85,172,238,.4);
        }
        49.9% { 
          box-shadow: 0 0 0 5px rgba(85,172,238,0);
        }
        50% { 
          box-shadow: 0 0 0 0 rgba(85,172,238,0);
        }
        75% {
          box-shadow: 0 0 0 3px rgba(85,172,238,.6);
        }
        99.9% {
          box-shadow: 0 0 0 7px rgba(85,172,238,0);
        }
        100% {
          box-shadow: 0 0 0 0 rgba(85,172,238,0);
        }

    }

    @-webkit-keyframes pulse {
        0% {
          box-shadow: 0 0 0 0 rgba(85,172,238,0);
        }
        25% { 
          box-shadow: 0 0 0 2px rgba(85,172,238,.4);
        }
        49.9% { 
          box-shadow: 0 0 0 5px rgba(85,172,238,0);
        }
        50% { 
          box-shadow: 0 0 0 0 rgba(85,172,238,0);
        }
        75% {
          box-shadow: 0 0 0 3px rgba(85,172,238,.6);
        }
        99.9% {
          box-shadow: 0 0 0 7px rgba(85,172,238,0);
        }
        100% {
          box-shadow: 0 0 0 0 rgba(85,172,238,0);
        }

    }

这是工作笔:http://codepen.io/munkhbayar/pen/OPgQaM

在这里学习 CSS3 动画示例:http://www.w3schools.com/css/css3_animations.asp

关于html - 如何使 Css 过渡效果在 Safari 和 Chrome 上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28133870/

相关文章:

php - foreach 结果分为两列

css - 谷歌字体在某些 Mac 上不工作

CSS :after-icon on :hover makes box bigger

css - 如何检测CSS继承来源?

javascript - Chrome 不保留 CORS cookie

PHP 标记删除文档中的最后一个换行符

javascript - AngularJS 1.5 组件不会在更改时调用 $onChanges

CSS3 变换 : translate maximum value?

html - 表格单元格中的溢出文本

css - Ng-bootstrap 'ngbPopover' 不是当父容器具有 'transform' css 属性时