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.

            
              <div class="bg">
 <div class="wrapper">
  <div class="container">
   <div class="item" data-anim="0"></div>
		<div class="item" data-anim="0"></div>
  </div>
  <nav>
   <div class="bar left">
    <a title="add item">
     <div class="btn" id="add"><i class="fa fa-plus-square"></i></div>
    </a>
    <a title="remove item">
     <div class="btn" id="del"><i class="fa fa-minus-square"></i></div>
    </a>
    <a title="line break">
     <div class="btn" id="bre"><i class="fa fa-paragraph"></i></div>
    </a>
    <a title="increase margin">
     <div class="btn" id="map"><i class="fa fa-expand"></i></div>
    </a>
    <a title="decrease margin">
     <div class="btn" id="mam"><i class="fa fa-compress"></i></div>
    </a>
    <a title="increase size">
     <div class="btn" id="inc"><i class="fa fa-plus-square-o"></i></div>
    </a>
    <a title="decrease size">
     <div class="btn" id="dec"><i class="fa fa-minus-square-o"></i></div>
    </a>

   </div>
  </nav>
  <nav>
   <div class="bar right">
    <a title="flex-direction">
     <div class="btn" id="dir"><i class="fa fa-exchange"></i></div>
    </a>
    <a title="justify-content">
     <div class="btn" id="jus"><i class="fa fa-align-left"></i></div>
    </a>
    <a title="align-content">
     <div class="btn" id="ali"><i class="fa fa-arrows-v"></i></div>
    </a>
    <div class="divider"></div>
    <a title="flex-wrap">
     <div class="btn on" id="wra"><i class="fa fa-level-down fa-rotate-90"></i></div>
    </a>
    <a title="flex-grow">
     <div class="btn off" id="gro">
      <i class="fa fa-caret-left"></i>
      <i class="fa fa-caret-right"></i>
     </div>
    </a>
    <a title="flex-shrink">
     <div class="btn off" id="shr">
      <i class="fa fa-caret-right"></i>
      <i class="fa fa-caret-left"></i>
     </div>
    </a>
   </div>
  </nav>
	 <div id="alert"> Resize Me! </div>
 </div>
 <aside>
  <p id="dirInfo">flex-direction: row</p>
  <p id="jusInfo">justify-content: flex-start</p>
  <p id="aliInfo">align-content: flex-start</p>
  <p id="wraInfo">flex-wrap: wrap</p>
  <p id="shrInfo">flex-shrink: 0</p>
  <p id="groInfo">flex-grow: 0</p>
  <p id="marInfo">margin: 5px</p>
  <p id="sizInfo">size: 80px</p>
	</aside>
<footer>
	<p> by <a href="https://codepen.io/Semaviro/full/oZZgRx/" target="_blank">Seb</a></p>
 <p class="credits">Icons: <a href="http://fontawesome.io" title="www.fontawesome.io">Font Awesome</a></p><p>Emoji: <a href="http://www.flaticon.com/authors/madebyoliver" title="Madebyoliver">Madebyoliver</a> via <a href="http://www.flaticon.com" title="www.flaticon.com">Flaticon</a></p>
</footer>
	
</div>
            
          
!
            
              .bg {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
}

.wrapper {
    position: relative;
    margin: auto;
}


.container {
		width: 368px;
    height: 184px;
    max-width: 800px;
    max-height: 500px;
    overflow: hidden;
    resize: both;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-content: flex-start;
}
/*workaround for min-width and min-height
.container:active {
  width: 190px;
  height: 95px;
}
*/

.item {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 5px;
    line-height: 80px;
    vertical-align: middle;
    text-align: center;
    flex-grow: 0;
    flex-shrink: 0;
    transition: all 200ms;
}

break {
    flex-basis: 100%;
}

.emoji {
    height: 100%;
    width: 100%;
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("https://image.flaticon.com/icons/svg/135/135975.svg");
}


/*-----------*/

nav {
    user-select: none;
}
.left {
	float: left;
}
.right {
	float: right;
}

.btn,
.item,
#alert {
    cursor: pointer;
}

.btn,
.divider {
    display: inline-block;
    height: 20px;
    width: 20px;
	margin: 0;
    line-height: 20px;
    vertical-align: middle;
    text-align: center;
}


/*-----------*/

aside,
footer {
    position: absolute;
    left: 10px;
    font-size: 14px;
		font-family: Courier, "Andale Mono";
}

footer {
    bottom: 18px;
    font-size: 11px;
}
p {
    margin-bottom: -.8em;
}

#alert {
	position: absolute;
	bottom: -50px;
	right: -50px;
	font-size: 26px;
	font-family: "Comic Sans MS", cursive;
}

/*-------THEME--------*/

.bg {
    background: #0F1626;
    
}

.wrapper {
    padding: 4px;
    background: #8EAEBD;
    box-shadow: inset 0 0 1px 1px white;
    border-radius: 4px;
}

.container {
    margin-bottom: 4px;
    background: #30415D;
    box-shadow: 0 0 1px 1px white;
    border-radius: 2px;
}

.item {
    background: #FEDC3D;
    background: radial-gradient(circle, #FFE545, #FEDC3D);
    box-shadow: inset 0 0 2px 3px rgba(255, 255, 255, .3);
    border-radius: 8px;
    border: 1px solid #FEDC3D;
}

.btn {
    border-radius: 2px;
}

.btn:hover {
	box-shadow: inset 0 0 1px 1px #30415D;
}

.btn:active {
    background: #30415D;
}

.on {
    background-color: #6A9A1F;
    border-radius: 50%;
}

.off {
    background-color: #ec4a1a;
    border-radius: 50%;
}
a {
    color: #0a1612;
}
p,
p > a {
    color: #AAA
}
#alert {
	color:  #FC4A1A;
}



/*-------ANIMATIONS--------*/

[data-anim="1"] {
    animation: bounce .2s ease-in-out alternate infinite;
}

[data-anim="2"] {
    animation: jiggle .1s linear alternate infinite;
}

[data-anim="3"] {
    animation: spin 2s linear infinite;
}

[data-anim="4"] {
    animation: pulse 1s alternate infinite;
}

[data-anim="5"] {
    animation: spinNpulse 2s linear infinite;
}

[data-anim="6"] {
    animation: wobble .2s linear alternate infinite;
}

[data-anim="7"] {
    animation: spinX 2s linear infinite;
}

@keyframes bounce {
    0% {
        transform: translateY(10px) scaleX(1.1) scaleY(.9)
    }
    100% {
        transform: translateY(-15px) scaleX(.9) scaleY(1.1)
    }
}

@keyframes jiggle {
    0% {
        transform: rotate(-5deg)
    }
    100% {
        transform: rotate(5deg)
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg)
    }
    100% {
        transform: rotate(360deg)
    }
}

@keyframes pulse {
    0% {
        transform: scale(0)
    }
    100% {
        transform: scale(1)
    }
}

@keyframes spinNpulse {
    0% {
        transform: scale(1) rotate(0deg)
    }
    50% {
        transform: scale(.1) rotate(180deg)
    }
    100% {
        transform: scale(1) rotate(360deg)
    }
}

@keyframes wobble {
    0% {
        transform: skewX(-20deg)skewY(-20deg)
    }
    100% {
        transform: skewX(20deg)skewY(20deg)
    }
}

@keyframes spinX {
    0% {
        transform: rotate3d(0, 0, 0, 0deg)
    }
    100% {
        transform: rotate3d(1, 0, 0, 360deg)
    }
}
            
          
!
            
              $(function() {
	
	var direction = $(".container").css("flex-direction")
	
	/* add & remove items: */
    $("#add").click(function() {
		 var width = $(".container").css("width")
		 var height = $(".container").css("height")
		 var margin = $(".item").css("margin");
		 var size = $(".item").css("height");
		 var shrink = $(".item").css("flex-shrink");
		 var grow = $(".item").css("flex-grow")
       $(".container").append('<div class="item" data-anim="0"></div>');
		 $(".item").last().css({"margin":margin,"width":size,"height":size, "flex-shrink":shrink, "flex-grow":grow});;
		 $(".container").css({"width": width, "height": height})
    });
	
	$("#del").click(function() {
        $(".container").children().last().remove();
	 });
	
	/* line break: */
	$("#bre").click(function() {
        $(".container").append('<break></break>');
    });

	/*margin*/
	$("#map").click(function() {
		var margin = $(".item").css("margin");
		margin = margin.substr(0,margin.length-2);
		margin = Math.round(Number(margin) + 5);
		margin = String(margin)+"px";
		$(".item").each(function(){
			$(this).css({"margin":margin});
		});
		$("#marInfo").html("margin: "+margin);
	});
	$("#mam").click(function() {
		var margin = $(".item").css("margin");
		margin = margin.substr(0,margin.length-2);
		margin = Math.round(Number(margin) - 5);
		margin = String(margin)+"px";
		$(".item").each(function(){
			$(this).css({"margin":margin});
		});
		$("#marInfo").html("margin: "+margin);
	});
		 
	/*size*/
	$("#inc").click(function() {
		var size = $(".item").css("height");
		size = size.substr(0,size.length-2);
		size = Math.round(Number(size) + 10);
		size = String(size)+"px";
		$(".item").each(function(){
			$(this).css({"width":size,"height":size});
		});
		$("#sizInfo").html("size: "+size);
	});
	$("#dec").click(function() {
		var size = $(".item").css("height");
		size = size.substr(0,size.length-2);
		size = Math.round(Number(size) - 10);
		size = String(size)+"px";
		$(".item").each(function(){
			$(this).css({"width":size,"height":size});
		});
		$("#sizInfo").html("size: "+size);
	});
	
	/*---------------------------------*/
	
	
	/*flex-direction*/
	$("#dir").click(function() {
		direction = $(".container").css("flex-direction");
		if (direction==="row") {
			direction = "column";
			$("#dir").html('<i class="fa fa-exchange fa-rotate-90"></i>');
			$("#jus").children().addClass("fa-rotate-90");
			$("#ali").children().addClass("fa-rotate-90");
		}
		else {
			direction="row";
			$("#dir").html('<i class="fa fa-exchange"></i>');
			$("#jus").children().removeClass("fa-rotate-90");
			$("#ali").children().removeClass("fa-rotate-90");
		}
		$(".container").css({"flex-direction":direction});
		$("#dirInfo").html("flex-direction: "+direction);
	});
	
	/* justify-content: */
    $("#jus").click(function() {
        var currentJus = $(".container").css("justify-content");
        var newJus = "";
        switch (currentJus){
            case "flex-start":
				  newJus = "flex-end";
				  $("#jus").html('<i class="fa fa-align-right"></i>')
				  break;
            case "flex-end":
				  newJus = "center";
				  $("#jus").html('<i class="fa fa-align-center"></i>')
				  break;
            case "center":
				  newJus = "space-between";
				  $("#jus").html('<i class="fa fa-align-justify"></i>')
				  break;
            case "space-between": newJus = "space-around"; break;
				case "space-around":
				  newJus = "flex-start";
				  $("#jus").html('<i class="fa fa-align-left"></i>')
				  break;
        }
		 if (direction==="column") {
			$("#jus").children().addClass("fa-rotate-90");
		}
        $(".container").css({ "justify-content": newJus }); 
		 $("#jusInfo").html("justify-content: "+newJus);
    });
		 
	/* align-content */
	$("#ali").click(function() {
        var currentAli = $(".container").css("align-content");
        var newAli = "";
        switch (currentAli){
            case "flex-start": newJus = "flex-end"; break;
            case "flex-end": newJus = "center"; break;
            case "center": newJus = "space-between"; break;
            case "space-between": newJus = "space-around"; break;
				case "space-around": newJus = "stretch"; break;
				case "stretch": newJus = "flex-start"; break;
        }
        $(".container").css({ "align-content": newJus }); 
		 $("#aliInfo").html("align-content: "+newJus);
    });
		 
	/*------------*/
		 
	/*flex-wrap*/
	$("#wra").click(function() {
		var wrap = $(".container").css("flex-wrap");
		if (wrap==="wrap") {
			wrap = "nowrap";
			$("#wra").removeClass("on").addClass("off");
		}
		else {
			wrap="wrap";
			$("#wra").removeClass("off").addClass("on");
		}
		$(".container").css({"flex-wrap":wrap});
		$("#wraInfo").html("flex-wrap: "+wrap);
	});
		 
	/*flex-grow*/
	$("#gro").click(function() {
		var grow = $(".item").css("flex-grow");
		if (grow==="0") {
			grow = "1";
			$("#gro").removeClass("off").addClass("on");
		}
		else {
			grow="0";
			$("#gro").removeClass("on").addClass("off");
		}
		$(".item").css({"flex-grow":grow});
		$("#groInfo").html("flex-grow: "+grow);
	});
		 
	/*flex-shirnk*/
	$("#shr").click(function() {
		var shrink = $(".item").css("flex-shrink");
		if (shrink==="0") {
			shrink = "1";
			$("#shr").removeClass("off").addClass("on");
		}
		else {
			shrink="0";
			$("#shr").removeClass("on").addClass("off");
		}
		$(".item").css({"flex-shrink":shrink});
		$("#shrInfo").html("flex-shrink: "+shrink);
	});
		 
	/*---------------------------------*/
		 
	/*animations*/
	$(".wrapper").on("click", ".item", function(){
		var anim = $(this).attr("data-anim");
		if (anim==="0")	{ 
			anim = String(Math.ceil(Math.random()*7));
			$(this).html('<div class="emoji"></div>')
			}
		else {
			anim = "0";
			$(this).html('');
		}
		$(this).attr("data-anim",anim);
		
	})
});


/*alert*/


$(function() {
  setTimeout(function(){$("#alert").remove()}, 3000);
	$("#alert").click(function(){$(this).remove()});
});
	
            
          
!
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