Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <link href="https://fonts.googleapis.com/css?family=Quicksand:300,400,500,700" rel="stylesheet">
	<div class="warning">
		This page uses <a href="https://css-tricks.com/snippets/css/complete-guide-grid/" title="CSS Grid Layout" target="_blank">CSS Grid Layout</a>. If you are reading this message, your browser does not support this feature and you may not be able to see a grid of example boxes. You can check the browser compatibility <a href="http://caniuse.com/#feat=css-grid" title="Can I Use CSS Grid Layout" target="_blank">here</a>.
	</div>
	<h1>Simple Animations using CSS Borders</h1>
	<h3>Hover your mouse on the examples below to see the effect.</h3>
	<div class="grid-container">
		<div>
			<h2>1. Interchange border colors</h2>
			<div class="box box1"></div>
		</div>
		<div>
			<h2>2. Expand width</h2>
			<div class="box box2"></div>
		</div>
		<div>
			<h2>3. Expand width &amp; height</h2>
			<div class="box box3"></div>
		</div>
		<div>
			<h2>4. Rotate border colors using keyframe animations</h2>
			<div class="box box4"></div>
		</div>
		<div>
			<h2>5. Four colored circle</h2>
			<div class="box box5"></div>
		</div>
		<div>
			<h2>6. Two colored triangle</h2>
			<div class="box box6"></div>
		</div>
		<div>
			<h2>7. Two colored square</h2>
			<div class="box box7"></div>
		</div>
		<div>
			<h2>8. Missing top border</h2>
			<div class="box box8"></div>
		</div>
		<div>
			<h2>9. Down Arrow</h2>
			<div class="box box9"></div>
		</div>
		<div>
			<h2>10. Left Arrow</h2>
			<div class="box box10"></div>
		</div>
		<div>
			<h2>11. Up Arrow</h2>
			<div class="box box11"></div>
		</div>
		<div>
			<h2>12. Right Arrow</h2>
			<div class="box box12"></div>
		</div>
	</div>

	<footer>
		<a href="https://github.com/mpsinghk/animations-using-css-borders" title="Fork on GitHub" target="_blank">Fork on GitHub</a>
	</footer>
              
            
!

CSS

              
                /* Base
------------------------------------------------------- */
body {
  font-family: 'Quicksand', sans-serif;
  font-size: calc(16px + 0.3vw);
  font-weight: 300;
  line-height: 1.4;
  text-align: center;
  padding: 40px 30px 30px;
}

/* Typography
------------------------------------------------------- */
h1 {
  font-size: 3.2em;
  line-height: 1.1;
  font-weight: 700;
  margin: 0 0 0.3em;
}

h2 {
  font-size: 1.2em;
  line-height: 1.3;
  font-weight: 400;
  margin: 0 0 0.8em;
}

a,
a:hover,
a:focus {
  text-decoration: none;
  color: #00a7e3;
}

/* Footer
------------------------------------------------------- */
footer {
  font-size: 0.9em;
  padding: 20px;
  margin-top: 50px;
  border-top: 1px solid #ccc;
}

/* CSS Grid Layout
------------------------------------------------------- */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  grid-gap: 20px;
}

.grid-container > div {
  border: 1px solid #ccc;
  padding: 30px;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

/* Warning message if using old browser
that does not support CSS Grid Layout.
------------------------------------------------------- */
.warning {
  padding: 20px;
  margin-bottom: 30px;
  background: #f7b563;
  border: 1px solid #e88d1a;
  border-radius: 3px;
}

.warning a {
  color: #fff;
}

@supports (display: grid) {
  .warning {
    display: none;
  }
}

/* Example boxes
------------------------------------------------------- */
.box {
  display: inline-block;
  cursor: pointer;
  width: 100px;
  height: 100px;
  border-width: 35px;
  border-style: solid;
  border-color: cyan magenta yellow black;
  -webkit-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
}

.box1:hover,
.box1:focus {
  border-color: yellow black cyan magenta;
}

.box2 {
  width: 0;
}

.box2:hover,
.box2:focus {
  width: 100px;
}

.box3 {
  width: 0;
  height: 0;
}

.box3:hover,
.box3:focus {
  width: 100px;
  height: 100px;
}

@-webkit-keyframes rotate-borders {
  25% { border-color: black cyan magenta yellow; }
  50% { border-color: yellow black cyan magenta; }
  75% { border-color: magenta yellow black cyan; }
  100% { border-color: cyan magenta yellow black; }
}

@keyframes rotate-borders {
  25% { border-color: black cyan magenta yellow; }
  50% { border-color: yellow black cyan magenta; }
  75% { border-color: magenta yellow black cyan; }
  100% { border-color: cyan magenta yellow black; }
}

.box4 {
  -webkit-animation: rotate-borders 6s infinite;
          animation: rotate-borders 6s infinite;
}

.box5:hover,
.box5:focus {
  border-radius: 50%;
}

.box6:hover,
.box6:focus {
  width: 0;
  height: 0;
  border-width: 85px;
  border-color: transparent magenta yellow transparent;
}

.box7:hover,
.box7:focus {
  width: 0;
  height: 0;
  border-width: 0 170px 170px 0;
  border-color: transparent magenta yellow transparent;
}

.box8:hover,
.box8:focus {
  width: 0;
  height: 0;
  border-width: 85px;
  border-color: transparent magenta yellow black;
}

.box9:hover,
.box9:focus {
  width: 0;
  height: 0;
  border-width: 170px 85px 0 85px;
  border-color: cyan transparent transparent transparent;
}

.box10:hover,
.box10:focus {
  width: 0;
  height: 0;
  border-width: 85px 170px 85px 0;
  border-color: transparent magenta transparent transparent;
}

.box11:hover,
.box11:focus {
  width: 0;
  height: 0;
  border-width: 0 85px 170px 85px;
  border-color: transparent transparent yellow transparent;
}

.box12:hover,
.box12:focus {
  width: 0;
  height: 0;
  border-width: 85px 0 85px 170px;
  border-color: transparent transparent transparent black;
}
              
            
!

JS

              
                // Find me on Instagram
// https://www.instagram.com/mpsinghk
              
            
!
999px

Console