または、表示と非表示を段階的に切り替えたくない場合(テキストカーソルの点滅など)、次のように使用できます。
/* Also use prefixes with @keyframes and animation to support current browsers */
@keyframes blinker {  
  from { visibility: visible }
  to { visibility: hidden }
  /* Alternatively you can do this:  
  0% { visibility: visible; }
  50% { visibility: hidden; }
  100% { visibility: visible; }
  if you don't want to use `alternate` */
}
.cursor {
  animation: blinker steps(1) 500ms infinite alternate;
}
すべて1s .cursorがからvisibleに行きhiddenます。
CSSアニメーションがサポートされていない場合(Safariの一部のバージョンなど)、この単純なJS間隔にフォールバックできます。
(function(){
  var show = 'visible'; // state var toggled by interval
  var time = 500; // milliseconds between each interval
  setInterval(function() {
    // Toggle our visible state on each interval
    show = (show === 'hidden') ? 'visible' : 'hidden';
    // Get the cursor elements
    var cursors = document.getElementsByClassName('cursor');
    // We could do this outside the interval callback,
    // but then it wouldn't be kept in sync with the DOM
    // Loop through the cursor elements and update them to the current state
    for (var i = 0; i < cursors.length; i++) {
      cursors[i].style.visibility = show;
    }
  }, time);
})()
この単純なJavaScriptは実際には非常に高速であり、多くの場合、CSSよりも優れたデフォルトである可能性さえあります。JSアニメーションが遅くなるのは、多くのDOM呼び出し(JQueryの$ .animate()など)であることは注目に値します。
また.cursor、後で要素を追加した場合でも.cursor、状態が共有されているため、要素が他のとまったく同時にアニメーション化するという2番目の利点があります。これは、CSSでは私が知る限り不可能です。