css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <header>
	<h1>Special effects</h1>
	<h2>Css examples</h2>
</header>
<div id="content">
	
	<p class="rounded_border" title="Demo of a paragraph with rounded corners">
		Demo of a paragraph with rounded corners and text with an online font: 'Indie Flower'.
		The subtitle of this page also uses a true-type font, 'Meie Script', both fonts are from the <a href="https://fonts.google.com/">Google Fonts</a>.
	</p>

	<div class="circle">
		<p><code>&lt;div&gt;</code> with<br>rounded corners<br>to create a circle.<br><a href="http://css3shapes.com/">More shapes</a>.</p>
	</div>
	
	<div class="hovereffect">
		<img src="https://home.et.utwente.nl/slootenvanf/div/img.png" width="245" height="122">
		<p>&lt;div&gt; with hover-effect highlight, mouse cursor pointer.</p>
	</div>

	<div class="hover_transition">
		<p>Demo transition - move your mouse over this area</p>
	</div>

	<div class="rotate45 semi_transparent" style="margin-left:50px">
		<p>Anything with <b>class</b> <i>rotate45</i> will be rotated 45 degrees. The background-color of this element is semi-transparent (uses rgba()-color spec.).
		Default point of rotation is the center of an element, <a href="https://css-tricks.com/almanac/properties/t/transform-origin/">but you can change this</a>.</p>
	</div>
	
	<div id="player">
		<audio src="https://home.et.utwente.nl/slootenvanf/div/tone.mp3" autoplay loop controls>Your browser does not support the audio element.</audio>
	</div>
	
	<p>Below there are two drawings on canvas elements: a simple rectangle, and glowing lines</p>
	<canvas id="drawing">Your browser does not support the canvas element.</canvas>
	<canvas id="pretty_glowing_lines">Your browser does not support the canvas element.</canvas>
	
	<p>Below there is a flying bird. It's movement across the page is made with a css animation. The image <a href="https://home.et.utwente.nl/slootenvanf/div/bird.gif">itself</a> is an animated gif, with flapping wings.</p>
	<img class="bird fly" src="https://home.et.utwente.nl/slootenvanf/div/bird.gif" alt="This bird flies"></p>
<p>The gradient color used as a background for this <code>&lt;div&gt;</code> was created with <a href="http://www.colorzilla.com/gradient-editor/" target="_blank">Colorzilla's gradient-editor</a>. <a href="https://css-tricks.com/guides/css-gradients/" target="_blank">Css-tricks also has useful guides on gradients</a>.</p>

</div><!-- /content -->

<p id="agent"></p>
            
          
!
            
              /* include 2 Google fonts:*/
@import url('https://fonts.googleapis.com/css?family=Indie+Flower|Meie+Script');

html {
	height: 100%;
}

body {
	height: 90%;
	margin: 20px;
	padding: 0;
	font-family: "Trebuchet MS", Helvetica, sans-serif;
}

#content {
/* Known problem: In this example, we use a border radius and a gradient and apply it to one div. Unfortunatly, older versions of Internet Explorer does not round the corners properly if you use a CSS gradient. */

position: relative;
padding: 20px;
border: 1px solid #fff;
border-radius: 8px;
min-height: 100%;
margin: auto;

/* gradient background generated by http://www.colorzilla.com/gradient-editor/ : */

/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#feb645+0,f1e767+100 */
background: #feb645; /* Old browsers */
background: -moz-linear-gradient(top, #feb645 0%, #f1e767 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #feb645 0%,#f1e767 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #feb645 0%,#f1e767 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feb645', endColorstr='#f1e767',GradientType=0 ); /* IE6-9 */

}


h2 {
font-family: 'Meie Script', cursive; /* from https://www.google.com/webfonts */
}

.rounded_border {
border: 4px outset red;
border-radius: 8px;
width: 300px;
padding: 10px;
}

/* selector: select all paragraph elements with the word 'Demo' in the title */
p[title*="Demo"] {
  font-family: 'Indie Flower', cursive;
  color: white;
}

div.circle  {
height: 10em;
width: 10em;
border-radius: 5em;
-webkit-border-radius: 5em;
-moz-border-radius: 5em;
border: 0.2em solid #888943;
background-color: #CACC7F;
overflow:hidden;
}

.circle p  {
	text-align: center;
	margin-top: 4.5em;
	font-size: 0.7em;
}

div.hover_transition {
width:100px;
height:100px;
margin:10px;
padding:1em;
font-size: 0.7em;
outline:2px solid #DDD;
transition:width 2s, height 2s, transform 2s;
-moz-transition:width 2s, height 2s, -moz-transform 2s; /* Firefox 4 */
-webkit-transition:width 2s, height 2s, -webkit-transform 2s; /* Safari and Chrome */
-o-transition:width 2s, height 2s, -o-transform 2s; /* Opera */
}

div.hover_transition:hover {
width:200px;
height:200px;
transform:rotate(180deg);
-moz-transform:rotate(180deg); /* Firefox 4 */
-webkit-transform:rotate(180deg); /* Safari and Chrome */
-o-transform:rotate(180deg); /* Opera */
}

.rotate45 {
transform: rotate(45deg);
-ms-transform: rotate(45deg); /* IE 9 */
-moz-transform: rotate(45deg); /* Firefox */
-webkit-transform: rotate(45deg); /* Safari and Chrome */
-o-transform: rotate(45deg); /* Opera */
}

.rotate3n {
transform:rotate(-3deg);
-ms-transform:rotate(-3deg); /* IE 9 */
-moz-transform:rotate(-3deg); /* Firefox */
-webkit-transform:rotate(-3deg); /* Safari and Chrome */
-o-transform:rotate(-3deg); /* Opera */
}

.semi_transparent {
padding: 5px;
width: 200px;
border: 1px dashed red;
background-color: rgba(200, 0, 200, 0.5);
clear: both;
}

div#player {
position: absolute;
right: 20px;
top:20px;
}

canvas#drawing {
	width: 360px;
	height: 240px;
}

canvas#pretty_glowing_lines {
	display: block;
	position: absolute;
	width: 800px;
	height: 450px;
	margin: 0;
	right: 20px;
	bottom: 20px;
}

.hovereffect {
position: absolute;
right: 20px;
top:80px;
cursor:pointer;
width: 245px;
height: 165px;
font-size: 0.7em;
color: #c8cbcb;
background-color: #1c1e1e;
background: linear-gradient(#262828,#1c1e1e); /* Standard top to bottom transition from first color to second. */
}

.hovereffect:hover {
opacity:0.80;
}

.hovereffect p {
	margin: 0;
	padding: 0 5px;
}

/*************************************************************
Animations:
*/

.bird {
	position: relative;
	display: block;
	left:-100px;
}

.fly {
  animation: animationFrames linear 10s;
  animation-iteration-count: infinite;
  -webkit-animation: animationFrames linear 10s;
  -webkit-animation-iteration-count: infinite;
  -moz-animation: animationFrames linear 10s;
  -moz-animation-iteration-count: infinite;
  -o-animation: animationFrames linear 10s;
  -o-animation-iteration-count: infinite;
  -ms-animation: animationFrames linear 10s;
  -ms-animation-iteration-count: infinite;
}

.fly:hover { /* hidden game: catch the bird ;-) */
	animation-play-state:paused;
	-webkit-animation-play-state:paused;
	-moz-animation-play-state:paused;
	-o-animation-play-state:paused;
	-ms-animation-play-state:paused;
}

@keyframes animationFrames {
  0% {
    left:-100px;
  }
  100% {
    left:100%;
  }
}

@-moz-keyframes animationFrames {
  0% {
    left:-100px;
    
  }
  100% {
    left:100%;
  }
}

@-webkit-keyframes animationFrames {
  0% {
    left:-100px;
  }
  100% {
    left:100%;
  }
}

@-o-keyframes animationFrames {
  0% {
    left:-100px;
  }
  100% {
    left:100%;
    
  }
}

@-ms-keyframes animationFrames {
  0% {
    left:-100px;
  }
  100% {
    left:100%;
  }
}

            
          
!
            
              // show information about the browser in div with id 'agent':
document.getElementById("agent").innerHTML="Agent: "+navigator.userAgent;

/* Demo 1: drawing on canvas: id="drawing" */
var canvas = document.getElementById('drawing');
var context = canvas.getContext('2d');
/*
	Now you can start drawing on the two-dimensional surface of the canvas element using the API documented
	in the HTML5 specification at http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
	The 2D API offers a lot of the same tools that you find in a graphics program like Illustrator:
	strokes, fills, gradients, shad-ows, shapes, and Bézier curves. The difference is that, instead
	of using a Graphical User Interface, you have to specify every-thing using JavaScript.
*/	

// This is how you specify that the stroke color should be red:
context.strokeStyle = '#990000';

// Now anything you draw will have a red outline. For example, if you want to draw a rectangle, use this syntax:
// strokeRect ( left, top, width, height );

// If you want to draw a rectangle that’s 100 by 50 pixels in size, positioned 20 pixels from the left and 30 pixels
// from the top of the canvas element:
context.strokeRect(20,30,100,50);

/* Demo 2: drawing on canvas: id="pretty_glowing_lines" 
Example from http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#examples */
var canvas = document.getElementById('pretty_glowing_lines');
var context = canvas.getContext('2d');

 var lastX = context.canvas.width * Math.random();
 var lastY = context.canvas.height * Math.random();
 var hue = 0;
 function line() {
   context.save();
   context.translate(context.canvas.width/2, context.canvas.height/2);
   context.scale(0.9, 0.9);
   context.translate(-context.canvas.width/2, -context.canvas.height/2);
   context.beginPath();
   context.lineWidth = 1 + Math.random() * 5;
   context.moveTo(lastX, lastY);
   lastX = context.canvas.width * Math.random();
   lastY = context.canvas.height * Math.random();
   context.bezierCurveTo(context.canvas.width * Math.random(),
                         context.canvas.height * Math.random(),
                         context.canvas.width * Math.random(),
                         context.canvas.height * Math.random(),
                         lastX, lastY);

   hue = hue + 10 * Math.random();
   context.strokeStyle = 'hsl(' + hue + ', 50%, 50%)';
   context.shadowColor = 'white';
   context.shadowBlur = 5;
   context.stroke();
   context.restore();
 }
 setInterval(line, 50); // execute the line function every 50 ms

 function blank() {
   context.clearRect( 0 , 0 , context.canvas.width, context.canvas.height );
 }
 setInterval(blank, 3000); // execute the line function every 3 sec.

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console