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

              
                <div class="l-feat-header">
	
		<svg id="feat-head-svg" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 2000 415" style="enable-background:new 0 0 2000 415;" xml:space="preserve">
		<style type="text/css">
			.st0{fill:#0076BD;}
			.st1{opacity:0.1;clip-path:url(#SVGID_2_);}
			.st2{fill:#0076BD;}
		</style>
		<rect x="1.1" y="1.7" id="feat-head-svg-rect" class="st0" width="1998.9" height="413.3"/>
		<g>
			<defs>
				<rect id="SVGID_1_" x="1.1" y="1.7" width="1998.9" height="415.8"/>
			</defs>
			<clipPath id="SVGID_2_">
				<use xlink:href="#SVGID_1_"  style="overflow:visible;"/>
			</clipPath>
			<g id="polygon-wrap">
				<g class="st1">
					<g>
						<polygon class="polygon st2" points="1159.9,1.1 1157.4,0.8 1158.2,5 1161.8,2.9 			"/>
						<g>
							<polygon class="polygon st2" points="1149.2,-1.2 1140.5,-4.6 1133.8,11.3 1150.7,8.2 				"/>
							<polygon class="polygon st2" points="1176.7,12.7 1168.5,8 1160.4,12.7 1168.6,27.8 				"/>
							<polygon class="polygon st2" points="1187.6,-1.3 1186.3,8 1203.1,11 1196.3,-4.8 				"/>
						</g>
						<polygon class="polygon st2" points="1175.1,2.8 1178.8,4.9 1179.5,0.7 1177,1.1 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="1121.3,11 1125.8,-5.5 1113.7,-17.8 1090.9,3.5 			"/>
						<polygon class="polygon st2" points="1150.9,24.1 1133.9,25.8 1136.2,57.1 1161.1,38 			"/>
						<polygon class="polygon st2" points="1206.9,23.7 1189.7,23 1180.5,37.4 1206.4,55 			"/>
						<polygon class="polygon st2" points="1213.1,-8.2 1218.6,8.2 1248.5,-1.1 1224.3,-21.1 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="1110,69.6 1104.2,38.2 1073.9,27.4 1052.9,81.7 			"/>
						<polygon class="polygon st2" points="1170.4,67.5 1143.2,84.3 1172.5,134.9 1198.7,82.6 			"/>
						<polygon class="polygon st2" points="1264.1,21.5 1234.7,34.1 1230.9,65.8 1288.6,74.4 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="1014.6,73.5 1029.4,19.5 989.8,-20.8 915,49 			"/>
						<polygon class="polygon st2" points="1111.8,116.5 1055.9,122.2 1063.6,224.9 1145.1,162.1 			"/>
						<polygon class="polygon st2" points="1295.5,115.4 1239.2,112.9 1208.9,160.2 1293.7,217.9 			"/>
						<polygon class="polygon st2" points="1315.7,10.7 1333.9,64.3 1431.8,33.9 1352.5,-31.6 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="1004.6,223.1 988.1,133.8 901.8,102.9 841.9,257.7 			"/>
						<polygon class="polygon st2" points="1176.8,217.2 1099.3,265.1 1183,409.4 1257.7,260.3 			"/>
						<polygon class="polygon st2" points="1444.2,85.9 1360.2,122 1349.5,212.4 1514.1,236.8 			"/>
						<polygon class="polygon st2" points="875.7,2.6 935.8,-66.7 906.4,-152.9 747,-103.3 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="769.9,230 807.4,93 707,-9.1 517.3,168 			"/>
						<polygon class="polygon st2" points="1016.3,339 874.5,353.5 1345.1,916.7 1100.8,454.7 			"/>
						<polygon class="polygon st2" points="1482,336.2 1339.2,329.9 1262.5,449.7 1928.5,899.1 			"/>
						<polygon class="polygon st2" points="1533.2,70.8 1579.4,206.7 1827.6,129.6 1626.5,-36.3 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="788.2,543.5 749.4,334.5 547.5,262.1 858.1,927.7 			"/>
						<polygon class="polygon st2" points="1817.6,222.3 1620.9,307 1595.7,518.6 1981.1,575.8 			"/>
						<polygon class="polygon st2" points="485,34 625.6,-128.3 557,-330.1 183.7,-214 			"/>
						<polygon class="polygon st2" points="1713.6,-168.8 1864.4,-15.7 2599.9,21.5 1769.4,-374.1 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="335,473.3 413.2,187.9 204.1,-24.9 -191.3,344.1 			"/>
						<polygon class="polygon st2" points="1925.4,141.6 2021.6,424.7 2989.8,567.2 2119.7,-81.6 			"/>
					</g>
					<g>
						<polygon class="polygon st2" points="-167.5,40.1 108.1,-277.9 424.5,-370.5 -307.1,-142.9 			"/>
						<polygon class="polygon st2" points="1852.9,-199.9 2066,16.4 2468,-359.1 1931.8,-490 			"/>
					</g>
				</g>
			</g>	
		</g>
		</svg>



	<div class="column">
		<h1 class="page-title screen-reader-text">
			Header 1
		</h1>
	</div>
</div>

<button type="button" class="btn btn-primary" id="btn-change-color">Change Color</button>
              
            
!

CSS

              
                .l-feat-header {
	display: block;
	float: left;
	width: 100%;
	height: 350px;
	background-color: #0075bf;
	position: relative;
	overflow: hidden;
	.column {
		max-width: 1170px;
		h1 {
			position: relative;
			top: 0;
			margin: 0;
			padding: 150px 5% 40px 5%;
			color: #fff;
			font-family: sans-serif;
			font-size: 7rem;
			line-height: 8rem;
			font-weight: 400;
			letter-spacing: normal;
			text-align: left;
			text-transform: none;
			@media (min-width: 1240px) {
				padding-right: 0;
				padding-left: 0;
			}
		}
	}
	svg#feat-head-svg {
		width: auto;
		height: 110%;
		position: absolute;
		top: 0;
		left: -50%;
		overflow: hidden;
		@media (min-width: 450px) {
			right: 0;
			left: 0;
			margin: 0 auto;
		}
		@media (min-width: 2000px) {
			width: 100%;
			height: auto;
		}
		#feat-head-svg-rect {
			width: 100%;
			-webkit-transition: all 2s ease 0.25s;
			transition: all 2s ease 0.25s;
		}
		#polygon-wrap {
			.polygon {
				-webkit-transition: all 2s ease 0.25s;
				transition: all 2s ease 0.25s;
			}
			&.fill-white {
				.polygon {
					fill: #fff;
				}
			}
			&.fill-red {
				.polygon {
					fill: #ff4611;
				}
			}
			&.fill-random {
				.polygon {
					
				}
			}
		}
		.fill-white{
			fill: #fff;
		}
		.fill-blue{
			fill: #0076BD;
		}
	}
}
button.btn-primary {
	display: block;
	float: left;
	width: auto;
	margin: 40px 0 30px 0;
	padding: 20px 25px;
	background-color: #ff4611;
	border: none;
	border-radius: 0;
	color: #fff;
	font-family: sans-serif;
	font-size: 1.6rem;
	line-height: 2.2rem;
	font-weight: 400;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	-webkit-transition: all 0.3s ease 0s;
	transition: all 0.3s ease 0s;
	&:hover {
		background-color: #DB3D10;
		border: none;
	}
}
.column {
	display: block;
	max-width: 1240px;
	margin: 0 auto;
}

html {
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	font-size: 50%;
	@media (min-width: 900px) {
		font-size: 55%;
	}
	@media (min-width: 1150px) {
		font-size: 62.5%;
	}
}
*, *:before, *:after {
  box-sizing: inherit;
}

              
            
!

JS

              
                $(function() {
	
	$("#feat-head-svg #polygon-wrap").attr("class", "fill-white");
	
	$("#btn-change-color").on("keypress click",function(e){
		if (e.keyCode === 13 || e.type === "click") {
			var randColor1 = "hsla(" + Math.floor(Math.random() * (360)) + ", 75%, 58%, 1)";
			var randColor2 = "hsla(" + Math.floor(Math.random() * (360)) + ", 75%, 58%, 1)";
			//console.log("color1:" + randColor1);
			//console.log("color2:" + randColor2);
			$("#feat-head-svg #polygon-wrap").attr("class", "fill-random");
			$(".fill-random .polygon").css("fill", randColor1);
			$("#feat-head-svg-rect").css("fill", randColor2);
		};
	});
});
              
            
!
999px

Console