Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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

              
                <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<!-- 

Hello Camper!

For now, the test suite only works in Chrome! Please read the README below in the JS Editor before beginning. Feel free to delete this message once you have read it. Good luck and Happy Coding! 

- The freeCodeCamp Team 

-->


<!doctype HTML>
<html lang="en">
  <head> 
    <title>Slurm, it's highly addictive!</title>
  </head>
  <body>
    <!--navbar/!-->
   <canvas id="background"></canvas>
    <header id="header">
      <div class="container-fluid navbar-inverse fixed-top">
        <nav class="navbar navbar-expand-lg navbar-dark bg-dark" id="nav-bar">
          <a class="navbar-brand" href="#jumbotron">
            <img id="header-img" src="https://i.ibb.co/0qXG9h4/logo-slurm.png" width="50" height="50" class="d-inline-block align-top" alt="logo_slurm">
          </a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon text-white"></span>
          </button>

          <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav ml-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#jumbotron">Home</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#newsletter">Newsletter</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#ad">Watch the ad</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#footer">Contact me</a>
              </li>
            </ul>
          </div>
        </nav>
      </div>
    </header><!--navbar end/!-->
    <!-- jumbotron start -->
    <section class="container py-5 my-5" id="jumbotron" >
        <div class="jumbotron jumbotron-fluid text-right text-white mt-3">
          <div class="container-fluid" id="jumbo">
          <h1 class="display-4">Whimmy wham wham woozzle</h1>
          <p class="sans-2">Win a party with <span class="color"><i class="color">Slurms MacKenzie</i></span></p>
          <p class="sans-1">I want you for a Slurm Party! Be the ONE on my 100's person exclusive party!</p>
          <a class="btn btn-outline-light btn-lg" href="#" role="button">Learn more</a>
        </div>
        </div>
    </section>  
    <!-- jumbotron end -->
    <!-- subscribe start -->
    <section class="newsletter container-fluid text-white py-5 my-5" id="newsletter">
      <div class="container">
        <div>
          <h1 class="display-4">Suscribe now to our newsletter!</h1>
          <p class="sans-2">It's <span class="color"><i class="color">highly addictive!</span></i></p>
        </div>
        <form action="https://www.freecodecamp.org/email-submit" id="form">
          <div class="form-group">
            <label class="sans-1" for="exampleInputEmail1">Email address</label>
            <input type="email" name="email" class="form-control" id="email" placeholder="Type your email adress here" required>
            <p id="emailHelp" class="form-text sans">You know we are going to sell your emails...</p>
          </div>
          <input type="submit" class="btn btn-outline-light btn-lg" value="Be Spammed"id="submit"></input>
        </form>
      </div>
    </section><!-- subscribe ends -->
    <!-- starts video ad -->
    <section class="container-fluid py-5 my-5" id="ad">
      <div class="container text-right text-white">
        <h1 class="display-4">Look for the Golden Caps inside the marked cans!</h1>
        <p class="sans-2">Watch the full ad!</p>
        <div class="mt-5 embed-responsive embed-responsive-16by9 shadow-lg">
         <iframe id="video" src="https://www.youtube.com/embed/VyMXpJqAub8" class="stroke" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
        </div>
        <p class="sans mt-3">* Odds of winning are mathematically insignificant.</p>
      </div> 
    </section><!-- end video ad</!-->
    <!-- starts related prods -->
    <section class="container-fluid py-5 my-5 family"> 
      <div class="container text-white">
        <h1 class="display-4">Meet the Slurm family</h1>
        <p class="sans-2">Brand <span class="color"><i class="color">new flavours</i></span> just for you!</p>
      </div>
      
      <div class="container">
        <div class="row text-center">
          <div class="col-sm text-white py-5">
            <h2>Super Slurm</h2>
            <p class="lead py-3 sans-1">So delicious that people cannot resist it and will drink it until they explode. Will you drink it? Seriously, will you??? It's highly addictive!</p>
            <img src="https://i.ibb.co/K232XHd/lata-slurm-super.png" class="mx-auto d-block shadow-lg stroke" alt="Super Slurm">
          </div>
          <div class="col-sm text-white py-5">
            <h2>Diet Slurm</h2>
            <p class="lead py-3 sans-1">A version of Slurm that presumably has less sugar and calories! Mix it with Mentos to create a geyser-like phenomenon!</p>
            <img src="https://i.ibb.co/xgxQn5G/lata-slurm-diet.png" class="mx-auto d-block shadow-lg stroke" alt="Diet Slurm">
          </div>
          <div class="col-sm text-white py-5">
            <h2>Slurm Loco</h2>
            <p class="lead py-3 sans-1">Can you belive it? Those who drink it glow green. Ouuu yeah! Try it for yourself.</p>
            <img src="https://i.ibb.co/Fg7mKxD/lata-slurm-loco.png"  class="mx-auto d-block shadow-lg stroke"alt="Slurm Loco">
          </div>
          <div class="col-sm text-white py-5">
            <h2>Slurm Medicinal Tonic</h2>
            <p class="lead py-3 sans-1">Slurm in the 2850s was sold as a medicine. You know What? We still doing it!</p>
            <img src="https://i.ibb.co/JFvwSvh/lata-slurm-medicinal-tonic.png" class="mx-auto d-block shadow-lg stroke" alt="">
          </div>
        </div>
      </div>
    </section><!-- end related prods</!-->

    <section class="footer container-fluid" id="footer">
      <footer class="container">
        <div class="py-5">
            <img src="https://i.ibb.co/WnrJWq2/slurm-party-footer.png" class="mx-auto d-block"  alt="slurm party">
        </div>
          <div class="social text-center">
            <h1 class="lead-4">Party on <i>amigo!</i></h1>
            <p class="lead">Follow us</p>
            <a href=""><i class="fab fa-facebook"></i></a>
            <a href=""><i class="fab fa-instagram"></i></a>
          </div>

      </footer>
    </section>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
  </body>
</html>
              
            
!

CSS

              
                body{
	font-family: "cooper-black-std",serif;
	font-weight: 400;
	font-style: normal;
	background-color: #0053a5 !important;
}
.btn{
	font-family: 'Darker Grotesque', sans-serif;
	text-transform: uppercase;
}
.jumbotron{
	background-image: url("https://i.ibb.co/mCvkKWD/lata-jumbotron.png");
	background-size: 48%;
	background-repeat: no-repeat;
	background-position: left;
	background-color: rgba(0,0,0,0);
  display:flex;
}
.navbar {
  background-color: #0053a5 !important;
}

.container-fluid.navbar-inverse.fixed-top {
    box-shadow: 0 0px 50px 1px #0000004d;
    background-color: #0053a5; 
}

#background {
	position: fixed;
	top: 0;
	left: 0;
	z-index: -100;
	background-color: rgba(0,83,165,.3);
}
.sans{
	font-family: 'Darker Grotesque', sans-serif;
	text-transform: uppercase;
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.1rem;
}
.sans-1{
	font-family: 'Darker Grotesque', sans-serif;
	text-transform: uppercase;
	font-size: 16px;
}

.sans-2{
	font-family: 'Darker Grotesque', sans-serif;
	font-weight: 500;
	font-size: 36px;
}
span.color{
	color: #aabd00;
}
i.color{
	font-weight: 700;
}
.form-control{
	width: 75%;

}
.newsletter{
	background-image: url("https://i.ibb.co/1R4KqR9/take-my-money.png");
	background-size: 20%;
	background-repeat: no-repeat;
	background-position: 95% 50%;
	background-color: rgba(0,0,0,0);
}	
.embed-responsive{
	border-color: white;
    border-style: solid;
    border-radius: 10px;
    border-width: 1rem;
}
section.footer{
	background-color: #fff;
	font-color:#0053a5;
}

i.fab.fa-facebook, i.fab.fa-instagram {
    margin-bottom: 50px;
   	font-size: 30px;
   	padding: 10px;
}

.stroke{
	border-color: white;
    border-style: solid;
    border-radius: 10px;
    border-width: 1rem;
}


@media only screen and (max-width: 500px) {
.display-4 {
    font-size: font-size: 2.8rem !important;
  }
}
              
            
!

JS

              
                /* 
 * background.js - simple abstract background generator
 *
 * Changes:
 *  21-Jan-2016
 *   > Cap frames to 10 on mobile to prevent scroll lag
 *  20-Jan-2016
 *   + Added more versatile mobile options
 *   > Using tabs and 80 width
 *   > Settings object instead of lotsa variables
 *   > Bokeh jitter now assumes inverted min/max, added x/y options instead
 *   - Removed previous change of rounding values, for better looks
 *   - Removed gradient jitter, not useful
 *  6-Jan-2016
 *   > Stored PI * 2 in var for better framerate on mobile
 *   > Drawing circles to off-screen canvas only once, reducing .arc() ops
 *   + Added mobile detection
 *   + In-depth mobile+debug options
 *
 * @author  pbondoer - http://bondoer.fr/
 * @license CC0 - https://creativecommons.org/publicdomain/zero/1.0/
 */

window.addEventListener("load", function() {
	var ctx = document.getElementById('background').getContext('2d');
	//gradient
	var options =
	{
		resolution: 1,
		gradient:
		{
			resolution: 1,
			smallRadius: 0,
			hue:
			{
				min: 208,
				max: 208
			},
			saturation:
			{
				min: 100,
				max: 100
			},
			lightness:
			{
				min: 32,
				max: 32
			}
		},
		bokeh:
		{
			count: 21,
			size:
			{
				min: 0.01,
				max: 0.3
			},
			alpha:
			{
				min: 0.05,
				max: 0.4
			},
			jitter:
			{
				x: 0.3,
				y: 0.3
			}
		},
		speed:
		{
			min: 0.0001,
			max: 0.006
		},
		debug:
		{
			strokeBokeh: false,
			showFps: false
		}
	};
	var mobile =
	{
		force: false,
		resolution: 0.5,
		bokeh:
		{
			count: 6
		}
	};
	//buffers
	var gradientBuffer = document.createElement('canvas').getContext('2d');
	var circleBuffer = document.createElement('canvas').getContext('2d');
	//render time, fps calculations, debug
	var time;
	var targetFps = 60; //not actual fps, but updates per second
	var curFps = 0;
	var cntFps = 0;
	var fps = 0;
	var w = 0;
	var h = 0;
	var scale = 0;
	//constants for faster calcs
	var pi2 = Math.PI * 2;
	//util functions
	function lerp(a, b, step) {
		return step * (b - a) + a;
	}
	function clamp(a) {
		if (a < 0) return 0;
		if (a > 1) return 1;
		return a;
	}
	function rand(obj) {
		return Math.random() * (obj.max - obj.min) + obj.min;
	}
	function newColor() {
		return new Color(
				rand(options.gradient.hue),
				rand(options.gradient.saturation),
				rand(options.gradient.lightness)
				);
	}

	function isMobile() { 
		return (
				mobile.force
				|| navigator.userAgent.match(/Android/i)
				|| navigator.userAgent.match(/webOS/i)
				|| navigator.userAgent.match(/iPhone/i)
				|| navigator.userAgent.match(/iPad/i)
				|| navigator.userAgent.match(/iPod/i)
				|| navigator.userAgent.match(/BlackBerry/i)
				|| navigator.userAgent.match(/Windows Phone/i)
			   );
	}

	window.requestAnimFrame = (function(callback) {
		if (isMobile())
			return function(callback) {
				window.setTimeout(callback, 1000 / 10);
			};
		return window.requestAnimationFrame || window.webkitRequestAnimationFrame
			|| window.mozRequestAnimationFrame || window.oRequestAnimationFrame
			|| window.msRequestAnimationFrame || function(callback) {
				window.setTimeout(callback, 1000 / 60);
			};
	})();

	//classes
	function Color(h, s, l) {
		this.h = h;
		this.s = s;
		this.l = l;

		this.str = function() {
			return this.h + ", " + this.s + "%, " + this.l +"%";
		}
	}
	function ColorPoint(x, y, color) {
		this.x = x;
		this.y = y;
		this.oldColor = color;
		this.newColor = color;
		this.step = 0;
		this.speed = 0;

		this.color = function() {
			return new Color(lerp(this.oldColor.h, this.newColor.h, this.step),
					lerp(this.oldColor.s, this.newColor.s, this.step),
					lerp(this.oldColor.l, this.newColor.l, this.step));
		}

	}
	var colorPoints = [
		new ColorPoint(0, 0, new Color(196, 59, 34)),
		new ColorPoint(0, 1, new Color(269, 79, 32)),
		new ColorPoint(1, 0, new Color(30, 42, 33)),
		new ColorPoint(1, 1, new Color(304, 47, 27))
	];

	function BokehCircle(x, y, size, alpha) {
		this.oldX = x;
		this.oldY = y;
		this.oldSize = size;
		this.oldAlpha = alpha;
		this.newX = 0;
		this.newY = 0;
		this.newAlpha = 0;
		this.newSize = 0;
		this.step = 0;
		this.speed = 0;

		this.x = function() {
			return lerp(this.oldX, this.newX, this.step);
		}
		this.y = function() {
			return lerp(this.oldY, this.newY, this.step);
		}
		this.alpha = function() {
			return lerp(this.oldAlpha, this.newAlpha, this.step);
		}
		this.size = function() {
			return lerp(this.oldSize, this.newSize, this.step);
		}
	}
	var circles = [];

	function setJitter(circle) {
		circle.newX = clamp(circle.oldX + rand({
			min: -options.bokeh.jitter.x,
			max: options.bokeh.jitter.x
		}));
		circle.newY = clamp(circle.oldY + rand({
			min: -options.bokeh.jitter.y,
			max: options.bokeh.jitter.y
		}));
	}
	function resize() {
		var width = window.innerWidth;
		var height = window.innerHeight;

		w = width * options.resolution;
		h = height * options.resolution;
		scale = Math.sqrt(w * h);

		//actual canvas
		ctx.canvas.width = width;
		ctx.canvas.height = height;
		ctx.scale(1 / options.resolution, 1 / options.resolution);

		//circle canvas
		var circleSize = options.bokeh.size.max * scale;
		circleBuffer.canvas.width = circleSize * 2 + 1;
		circleBuffer.canvas.height = circleSize * 2 + 1;

		circleBuffer.fillStyle = "rgb(255, 255, 255)";
		circleBuffer.beginPath();
		circleBuffer.arc(circleSize, circleSize, circleSize, 0, pi2);
		circleBuffer.closePath();
		circleBuffer.fill();

		//force render on mobile
		if (isMobile())
			render();
	}
	function softCopy(src, dest)
	{
		var i = 0;

		for (var property in src)
		{
			if (dest.hasOwnProperty(property))
				if (softCopy(src[property], dest[property]) == 0)
					dest[property] = src[property];
			i++;
		}
		return i;
	}
	function init() {
		gradientBuffer.canvas.height = options.gradient.resolution;
		gradientBuffer.canvas.width = options.gradient.resolution;

		if (isMobile())
			softCopy(mobile, options);

		resize();

		colorPoints.forEach(function(point) {
			point.oldColor = newColor();
			point.newColor = newColor()
				point.speed = rand(options.speed);
		});

		for(i = 0; i < options.bokeh.count; i++) {
			circles.push(new BokehCircle(Math.random(), Math.random(),
						rand(options.bokeh.size), rand(options.bokeh.alpha)));
			circles[i].newAlpha = rand(options.bokeh.alpha);
			circles[i].newSize = rand(options.bokeh.size);
			circles[i].speed = rand(options.speed);
			setJitter(circles[i]);
		}
	}
	function iterate() {
		var now = Date.now();
		curFps += (now - (time || now));
		cntFps++;
		var delta = (now - (time || now)) / (1000 / targetFps);
		time = now;

		if(curFps > 1000) {
			fps = 1000 / (curFps / cntFps);
			curFps -= 1000;
			cntFps = 0;
		}

		colorPoints.forEach(function(point) {
			point.step += point.speed * delta;

			if (point.step >= 1) {
				point.step = 0;

				point.oldColor = point.newColor;

				point.newColor = newColor();
				point.speed = rand(options.speed);
			}
		});

		circles.forEach(function(circle) {
			circle.step += circle.speed * delta;
			if(circle.step >= 1) {
				circle.step = 0;

				circle.oldX = circle.newX;
				circle.oldY = circle.newY;
				circle.oldAlpha = circle.newAlpha;
				circle.oldSize = circle.newSize;

				setJitter(circle);
				circle.newAlpha = rand(options.bokeh.alpha);
				circle.newSize = rand(options.bokeh.size);
				circle.speed = rand(options.speed);
			}
		});
	}

	function render() {
		iterate();

		//draw point gradient to buffer
		colorPoints.forEach(function(point) {
			var x = point.x * options.gradient.resolution;
			var y = point.y * options.gradient.resolution;
			var grad = gradientBuffer.createRadialGradient(x, y,
					options.gradient.smallRadius, x, y,
					options.gradient.resolution);
			grad.addColorStop(0, 'hsla(' + point.color().str() + ', 255)');
			grad.addColorStop(1, 'hsla(' + point.color().str() + ', 0)');

			gradientBuffer.fillStyle = grad;
			gradientBuffer.fillRect(0, 0,
					options.gradient.resolution, options.gradient.resolution);
		});

		//draw gradient from memory
		ctx.globalCompositeOperation = "source-over";
		ctx.drawImage(gradientBuffer.canvas, 0, 0, w, h);

		//draw bokeh
		ctx.globalCompositeOperation = "overlay";
		if (options.debug.strokeBokeh)
			ctx.strokeStyle = "yellow";

		circles.forEach(function(circle) {
			var size = circle.size() * scale;

			ctx.globalAlpha = circle.alpha();
			ctx.drawImage(circleBuffer.canvas,
					circle.x() * w - size / 2, circle.y() * h - size / 2,
					size, size);

			if(options.debug.strokeBokeh) {
				ctx.globalAlpha = 1;
				ctx.globalCompositeOperation = "source-over";
				ctx.strokeRect(circle.x() * w - size / 2,
						circle.y() * h - size / 2, size, size);
				ctx.globalCompositeOperation = "overlay";
			}
		});
		ctx.globalAlpha = 1;

		//debug info
		if (options.debug.showFps) {
			if(fps <= 10) ctx.fillStyle = 'red';
			else ctx.fillStyle = 'yellow';

			ctx.font = "20px sans-serif";
			ctx.fillText(Math.round(fps) + " fps", 10, 20);
		}

		//done rendering, wait for frame
		window.requestAnimFrame(render);
	}

	//does not seem to impact performance
	window.addEventListener("resize", resize);

	//init and render :)
	init();
	render();
});

              
            
!
999px

Console