Skip to content

Instantly share code, notes, and snippets.

@AkashSaikia
Last active December 14, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkashSaikia/5168817 to your computer and use it in GitHub Desktop.
Save AkashSaikia/5168817 to your computer and use it in GitHub Desktop.
Simple Css3 based Blinking Cursor
Simple cursor based on Css3.
To test it, simply download the file and open in any of the latest browsers.
Browser Support :
Firefox 5+, IE 10+, Chrome, Safari 4+, Opera 12+
Learnings based on :
http://css-tricks.com/snippets/css/keyframe-animation-syntax/
http://coding.smashingmagazine.com/2011/05/17/an-introduction-to-css3-keyframe-animations/
This example is based on some articles and learnings, and have been used in my code too. So i do not own this code.
selection_cursor {
display: inline-block;
background: #111;
-webkit-animation: blink 1.2s linear 0s infinite;
-moz-animation: blink 1.2s linear 0s infinite;
-ms-animation: blink 1.2s linear 0s infinite;
-o-animation: blink 1.2s linear 0s infinite;
width:1px;
}
@-webkit-keyframes blink {
0% { opacity: 1; }
50% { opacity: 1; }
50.01% { opacity: 0; }
100% { opacity: 0; }
}
@-moz-keyframes blink {
0% { opacity: 1; }
50% { opacity: 1; }
50.01% { opacity: 0; }
100% { opacity: 0; }
}
@-ms-keyframes blink {
0% { opacity: 1; }
50% { opacity: 1; }
50.01% { opacity: 0; }
100% { opacity: 0; }
}
@-o-keyframes blink {
0% { opacity: 1; }
50% { opacity: 1; }
50.01% { opacity: 0; }
100% { opacity: 0; }
}
@keyframes blink {
0% { opacity: 1; }
50% { opacity: 1; }
50.01% { opacity: 0; }
100% { opacity: 0; }
}
<html>
<title>Simple css3 based blinking cursor</title>
<head>
<link rel="stylesheet" type="text/css" href="custom_cursor.css">
</head>
<body>
<pre>
<div class="selection_cursor" ></div>
</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment