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

              
                <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<div class="pattern"></div>
	<center >
	<div id="btn_scale"><i class="fa fa-check"></i><div  class="btn sbtn">Scale</div></div>
	<div id="btn_rotate"><i class="fa fa-check"></i><div class="btn rbtn">Rotate</div></div>
	</center>
	<h1>apply animation if you want</h1>
	<p>credits to <a href="https://www.behance.net/gallery/18010155/Ramadan-wallpaper">this project</a></p>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Ubuntu+Condensed);
body{
	background-color: #EBEBEB;
	margin: 0;
	padding: 0;
}
.pattern{
	width:100%;
	height: 380px;
	border-bottom:10px solid #393E42;
	overflow: hidden;
}
.star{
	width:40px;
	height: 40px;
	background-color: #393E42;
	position: absolute;	
}
.star::before{
	content: " ";
	width:40px;
	height: 40px;
	transform:rotate(45deg);
	position: absolute;
  	top:0px;
  	left:0px;
  	background-color: #393E42;
}
.star:nth-child(3n-1){
	background-color: #3EA194;
}
.star:nth-child(3n-1)::before{
	background-color: #3EA194;
}
.star:nth-child(3n){
	background-color: #C24232;
}
.star:nth-child(3n)::before{
	background-color: #C24232;
}
.row{
	width: 100%;
	height:40px;	
	position: relative;
}
.scale{
	animation:scale 1s linear infinite alternate;
}
@keyframes scale {
    from {transform: scale(1.0);}
    to {transform:scale(1.1);}
}
.rotate{
	animation:spin 4s linear infinite ;
}
@keyframes spin {
    from {transform:rotate(0deg);}
    to {transform:rotate(360deg);}
}
.anim{
animation:anim 4s linear infinite;
}
@keyframes anim {
    0% {transform:rotate(0deg)  scale(1.0);}
    50% {transform:rotate(180deg) scale(1.1);}
    100% {transform:rotate(360deg)  scale(1.0);}
}

.btn{
	width:200px;
	height:50px;
	background-color: #393E42;
	margin: 20px;
	color: #EBEBEB;
	text-align: center;
	font-family: 'Ubuntu Condensed', sans-serif;
	line-height: 50px;
	font-size: 22pt;
	display: inline-block;
	cursor: pointer;
	border-radius: 7px;
	
}	
i{
position: relative;
color: #EBEBEB;
top: 0;
left: 55px;
font-size: 22pt;
opacity: 0;
}
#btn_scale,#btn_rotate {
	
	color: #EBEBEB;
	font-size: 22pt;
	display: inline-block;	
}
h1{
	text-align: center;
	text-transform: uppercase;
	font-size: 25pt;
	color:#C24232;
	font-family: 'Ubuntu Condensed', sans-serif;
	text-shadow: 4px 4px 3px #bbb;
}
p{
	text-align: center;
	text-transform: uppercase;
	font-size: 15pt;
	color:#555;
	font-family: 'Ubuntu Condensed', sans-serif;
	}
a{
	text-decoration: none;
	color: #C24232;
	border-bottom: 1px dashed #C24232;
}

              
            
!

JS

              
                $(document).ready(function(){
var row_left=0;
var $pattern = $('.pattern');
var sclicked=false;
var rclicked=false;

for (var i = 0; i < 12; i++) {
	var init_left= 0;
	var row =document.createElement('div');
	row.setAttribute('class','row');
	var rowstyle={left : ""+row_left+"px"};
		$(row).css(rowstyle);
		row_left= row_left-40;
	for (var j = 1; j < 26; j++) {	
		var star = document.createElement('div');
		star.setAttribute('class','star');
		var style={left : ""+init_left+"px"};
		$(star).css(style);
		init_left= init_left+80;
		$(row).append(star);
	}
	$($pattern).append(row);
};
$( ".sbtn" ).click(function(e) {
	
	if(sclicked){
		$(e.target).css("background-color","#393E42");
		$(e.target).prev("i").css("opacity","0");
		$(".star").removeClass('scale anim');
		sclicked=false;
	}else{
		
		$(e.target).css("background-color","#3EA194");
		$(e.target).prev("i").css("opacity","1");
		$(".star").addClass('scale');
		if(rclicked){$(".star").removeClass('scale rotate').addClass('anim');}
		sclicked=true;
	}
});
  
 $( ".rbtn" ).click(function(e) {
 	
 	if(rclicked){
 		$(e.target).css("background-color","#393E42");
 		$(e.target).prev("i").css("opacity","0");
		$(".star").removeClass('rotate anim');
		rclicked=false;
	}else{

		$(e.target).css("background-color","#3EA194");
		$(e.target).prev("i").css("opacity","1");
		$(".star").addClass('rotate');
		if(sclicked){$(".star").removeClass('scale rotate').addClass('anim');}
		rclicked=true;
	}
 });   
});
              
            
!
999px

Console