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.

	<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">

<body onload="setPoint()">
	<a href="http://juliacodes.com"<div class="juliacodes">juliacodes.com</div></a>
	<div class="form-holder">
		<form onsubmit="return false;">
			<input type="text" value="196" placeholder="R" id="R">
			<input type="text" value="73" placeholder="G" id="G">
			<input type="text" value="0" placeholder="B" id="B"> <br />
			<button type="submit" onclick="setPoint()">Type your desired RGB and return</button>
	<div id="contain">
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
font-family: 'Open Sans', sans-serif;	

	padding: 0;
	margin: 0;
	background-color: #F5F6F8;
	text-decoration: none;

.form-holder { // centers the form
	width: 100%;
	height: auto;
	margin: 40px 0 0 0;
	positon: absolute;

button{ // return button resets colors form input
	background-color: white;
	border: none;
	font-size: 13px;
	margin-top: 20px;

form {
	position: relative;
	width: 300px;
	margin: auto;
	padding: 40px;
	background-color: #f9f9f9;
	box-shadow: 0px 0px 5px darkgray;
	border-top-left-radius: 30px;
	border-top-right-radius: 30px;
	outline: none;

	color: black;
	display: inline-block;
	text-align: center;
	font-size: 50px;
	border: none;
	margin-right: 2px;
	background-color: white;
	border-radius: 20px;
	box-shadow: 0px 0px 10px #f0f0f0;
	width: 95px;
	height: 95px;

#contain{ // div for centering gradient blocks
	margin-left: 20vw;
	z-index: 22;

.block {
	width: 66.5%;
  padding: 25px 25px;
	background-color: #B13400;
	opacity: 1;
	font-size: 20px;

	// set to important so it overrides javascript set color
	color: white !important;
	transition-duration: 1s !important;

#contain > :first-child{ // sets border radius for first child
	border-top-left-radius: 40px;
	border-top-right-radius: 40px;

.juliacodes{ // link to portfolio styling
	background-color: white;
	color: black;
	text-align: center;
	width: 120px;
	margin-left: 20px;
	padding: 5px;

textarea, select, input, button { //removes outline for all inputs
	outline: none; 

var elements = document.body.getElementsByTagName('div'); // declares individual blocks by div
var msg = ''; // declares and sets the initial rgb display to 0;
var i; // declaring all variables
var r;
var g; 
var b;

//function that grabs user input. Run on page load to initialize placeholder rgb
function setPoint(){
	// sets vars to match user input value
	r = parseInt(document.getElementById("R").value);
	g = parseInt(document.getElementById("G").value);
	b = parseInt(document.getElementById("B").value);
	for (i = 0; i < elements.length; i++){ // loops for each gradient block
		// sets a delay for each element, gives the opacity load - in effect
		var delay = i/2; 
		contain.getElementsByTagName('div')[i].style.transitionDuration = delay + 's';

		contain.getElementsByTagName('div')[i].style.backgroundColor = getColor(); // sets background color to getColor Function
		contain.getElementsByTagName('div')[i].innerHTML = getColor(); // sets inner html to match rgb color displayed
		contain.getElementsByTagName('div')[i].style.color = getColor(); // sets the color of text to match background-color
		// adds a plsu 10 interval to initial color to create gradient
		r += 10;
		g += 10;
		b += 10;
// function takes color vars and builds them into string
	function getColor(){
		var color = "rgb(" + r +","+ g +","+ b + ")";
		return color; // returns color that will be pulled for background

🕑 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.